21 lines
648 B
Python
21 lines
648 B
Python
import sys
|
|
import os
|
|
|
|
# Assuming check_db.py is in the project root
|
|
# Add the backend directory to sys.path so 'app' package can be found
|
|
sys.path.insert(0, os.path.abspath('ServerManagerWebApp/backend'))
|
|
|
|
# Now, import modules using their full path from the backend as root
|
|
# e.g., 'app.database' and 'app.models'
|
|
from app.database import SessionLocal
|
|
from app.models import VideoFile
|
|
|
|
try:
|
|
db = SessionLocal()
|
|
count = db.query(VideoFile).count()
|
|
print(f"Number of VideoFile entries in the database: {count}")
|
|
except Exception as e:
|
|
print(f"Error checking database: {e}")
|
|
finally:
|
|
if 'db' in locals() and db:
|
|
db.close() |