Files
Brancheneinstufung2/ARCHIVE_legacy_scripts/check_db_content.py
Floke d021b6b71c refactor: [30388f42] Strukturiere Root-Skripte thematisch neu
- Organisiert eine Vielzahl von Skripten aus dem Root-Verzeichnis in thematische Unterordner, um die Übersichtlichkeit zu verbessern und die Migration vorzubereiten.
- Verschiebt SuperOffice-bezogene Test- und Hilfsskripte in .
- Verschiebt Notion-bezogene Synchronisations- und Import-Skripte in .
- Archiviert eindeutig veraltete und ungenutzte Skripte in .
- Die zentralen Helfer  und  bleiben im Root, da sie von mehreren Tools als Abhängigkeit genutzt werden.
2026-03-06 10:16:08 +00:00

37 lines
1.1 KiB
Python

import sys
import os
import logging
logging.basicConfig(level=logging.INFO)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'company-explorer')))
from backend.database import SessionLocal, Company
def check_db_content():
db = SessionLocal()
try:
print("--- Checking content of 'companies' table ---")
companies = db.query(Company).limit(5).all()
if not companies:
print("!!! FATAL: The 'companies' table is EMPTY.")
# Let's check if the table is there at all
try:
count = db.query(Company).count()
print(f"Row count is confirmed to be {count}.")
except Exception as e:
print(f"!!! Could not even count rows. The table might be corrupt. Error: {e}")
else:
print(f"Found {len(companies)} companies. Data seems to be present.")
for company in companies:
print(f" - ID: {company.id}, Name: {company.name}")
finally:
db.close()
if __name__ == "__main__":
check_db_content()