Add MedicusWithClaude project - DB exploration scripts and notes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
MedicusWithClaude/inspect_table.py
Normal file
28
MedicusWithClaude/inspect_table.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import fdb
|
||||
import sys
|
||||
|
||||
table = sys.argv[1] if len(sys.argv) > 1 else 'DEKURS'
|
||||
|
||||
conn = fdb.connect(
|
||||
dsn=r'localhost:c:\medicus 3\data\medicus.fdb',
|
||||
user='SYSDBA', password='masterkey', charset='win1250'
|
||||
)
|
||||
cur = conn.cursor()
|
||||
|
||||
cur.execute("""
|
||||
SELECT rf.rdb$field_name, f.rdb$field_type, f.rdb$field_length
|
||||
FROM rdb$relation_fields rf
|
||||
JOIN rdb$fields f ON rf.rdb$field_source = f.rdb$field_name
|
||||
WHERE rf.rdb$relation_name = ?
|
||||
ORDER BY rf.rdb$field_position
|
||||
""", (table,))
|
||||
cols = cur.fetchall()
|
||||
print(f"=== {table} – sloupce ===")
|
||||
for c in cols:
|
||||
print(f" {c[0].strip():<30} typ: {c[1]} délka: {c[2]}")
|
||||
|
||||
cur.execute(f'SELECT COUNT(*) FROM {table}')
|
||||
print(f"\nPočet záznamů: {cur.fetchone()[0]}")
|
||||
|
||||
cur.close()
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user