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.
This commit is contained in:
28
ARCHIVE_legacy_scripts/check_schema.py
Normal file
28
ARCHIVE_legacy_scripts/check_schema.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import sqlite3
|
||||
|
||||
db_path = "/app/company-explorer/companies_v3_fixed_2.db"
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
for table in ['signals', 'enrichment_data']:
|
||||
print(f"\nSchema of {table}:")
|
||||
cursor.execute(f"PRAGMA table_info({table})")
|
||||
for col in cursor.fetchall():
|
||||
print(col)
|
||||
|
||||
print(f"\nContent of {table} for company_id=12 (guessing FK):")
|
||||
# Try to find FK column
|
||||
cursor.execute(f"PRAGMA table_info({table})")
|
||||
cols = [c[1] for c in cursor.fetchall()]
|
||||
fk_col = next((c for c in cols if 'company_id' in c or 'account_id' in c), None)
|
||||
|
||||
if fk_col:
|
||||
cursor.execute(f"SELECT * FROM {table} WHERE {fk_col}=12")
|
||||
rows = cursor.fetchall()
|
||||
for row in rows:
|
||||
print(dict(zip(cols, row)))
|
||||
else:
|
||||
print(f"Could not guess FK column for {table}")
|
||||
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user