openai-sql/nogui/test.py
2023-05-03 16:28:37 +02:00

24 lines
625 B
Python

import database.postgresql as pg
ip = 'localhost'
port = '32771'
username = 'root'
password = 'wv6G*Uny#4^CUA9E'
database = 'discord'
default_tables = ['']
postgres = pg.Postgres()
postgres.config(ip, port, username, password, database)
tables = postgres.fetchall('SELECT table_name FROM information_schema.tables;')
for table in tables:
if 'pg_' in table[0]:
continue
else:
print(table[0])
columns = postgres.fetchall(f'SELECT column_name FROM information_schema.columns WHERE table_name = \'{table[0]}\';')
for column in columns:
print(column[0])
print('\n')