Spaces:
Sleeping
Sleeping
Download check_schema.py from LalitChaudhari3/PlainSQL-Agent: direct link, hf CLI and curl.
- Browser
- Download file 576 Bytes
-
https://huggingface.co/spaces/LalitChaudhari3/PlainSQL-Agent/resolve/00a888ebf891bf46170f7dd295ce7c7a7bfd39f1/check_schema.py
- Command line
-
hf download hf://spaces/LalitChaudhari3/PlainSQL-Agent@00a888ebf891bf46170f7dd295ce7c7a7bfd39f1/check_schema.py
-
curl -L -o check_schema.py https://huggingface.co/spaces/LalitChaudhari3/PlainSQL-Agent/resolve/00a888ebf891bf46170f7dd295ce7c7a7bfd39f1/check_schema.py
576 Bytes
| import os | |
| from dotenv import load_dotenv | |
| from src.db_connector import Database | |
| # Load your actual database connection | |
| db = Database() | |
| print("\n--- ๐ REAL DATABASE SCHEMA ---") | |
| try: | |
| # Get all tables | |
| tables = db.get_tables() | |
| for table in tables: | |
| print(f"\n๐ TABLE: {table}") | |
| # Get columns for this table | |
| columns = db.get_table_schema(table) | |
| for col in columns: | |
| print(f" - {col}") | |
| print("\n-------------------------------") | |
| except Exception as e: | |
| print(f"โ Error reading schema: {e}") |