import os
import psycopg2
from dotenv import load_dotenv

load_dotenv()

def inspect_master_outlet():
    try:
        conn = psycopg2.connect(
            host=os.getenv("DB_HOST"),
            port=os.getenv("DB_PORT"),
            database=os.getenv("DB_NAME"),
            user=os.getenv("DB_USER"),
            password=os.getenv("DB_PASSWORD")
        )
        with conn.cursor() as cur:
            # Check columns in master_outlet using cursor.description
            cur.execute("SELECT * FROM master_outlet LIMIT 0;")
            colnames = [desc[0] for desc in cur.description]
            print("Columns in master_outlet:", colnames)
            
    except Exception as e:
        print(f"Error inspecting table: {e}")
    finally:
        if conn: conn.close()

if __name__ == "__main__":
    inspect_master_outlet()
