in skills/text_to_sql/evaluation/prompts.py [0:0]
def get_schema_info():
conn = sqlite3.connect(DATABASE_PATH)
cursor = conn.cursor()
schema_info = []
# Get all tables
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
for (table_name,) in tables:
# Get columns for this table
cursor.execute(f"PRAGMA table_info({table_name})")
columns = cursor.fetchall()
table_info = f"Table: {table_name}\n"
table_info += "\n".join(f" - {col[1]} ({col[2]})" for col in columns)
schema_info.append(table_info)
conn.close()
return "\n\n".join(schema_info)