import psycopg2

conn = psycopg2.connect(database="yiem_wine_assistant",
                        host="192.168.88.12",
                        user="yiem",
                        password="yiem@Postgres_0.0",
                        port="5432")

db_cursor = conn.cursor()


sql = '''
SELECT pg_namespace.nspname AS schema_name,
     relname AS table_name,
     pg_catalog.obj_description(pg_class.oid) AS comment
FROM pg_class
INNER JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
WHERE pg_namespace.nspname = 'public' -- Replace 'public' with your desired schema
  AND pg_class.relkind IN ('r', 't');
'''

db_cursor.execute(sql)


for record in db_cursor.fetchall():
  print(record)
