import psycopg2

# PostgreSQL connection config
POSTGRES_HOST = "198.168.12.40"   
POSTGRES_PORT = 5432
POSTGRES_DB = "Fyndo"
POSTGRES_USER = "postgres"
POSTGRES_PASSWORD = "fyndo123"

try:
    # Connect to PostgreSQL
    connection = psycopg2.connect(
        host=POSTGRES_HOST,
        port=POSTGRES_PORT,
        database=POSTGRES_DB,
        user=POSTGRES_USER,
        password=POSTGRES_PASSWORD
    )

    cursor = connection.cursor()

    # Query to get all tables
    cursor.execute("""
        SELECT table_name
        FROM information_schema.tables
        WHERE table_schema = 'public'
        ORDER BY table_name;
    """)

    tables = cursor.fetchall()

    print("\nAll Tables:\n")

    for table in tables:
        print(table[0])

    cursor.close()
    connection.close()

except Exception as e:
    print("Error:", e)