import os
import psycopg2
from dotenv import load_dotenv

load_dotenv()

def check_columns():
    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"),
            connect_timeout=10
        )
        print("Connected.")
        with conn.cursor() as cur:
            cur.execute("SELECT * FROM master_outlet LIMIT 0;")
            colnames = [desc[0] for desc in cur.description]
            print("Columns:", colnames)
        conn.close()
    except Exception as e:
        print(f"Error: {e}")

if __name__ == "__main__":
    check_columns()
