import pymysql

conn = pymysql.connect(
    host='officialsite.kr',
    port=23306,
    user='admin',
    password='dlgks~123',
    database='app_master',
    charset='utf8mb4'
)

cursor = conn.cursor()

# Find ad-related tables
cursor.execute("SHOW TABLES LIKE '%ad%'")
tables = cursor.fetchall()
print('Ad related tables:')
for t in tables:
    print(f'  - {t[0]}')

# Check balancepick specific tables
cursor.execute("SHOW TABLES LIKE 'balancepick%'")
tables = cursor.fetchall()
print('\nBalancepick tables:')
for t in tables:
    print(f'  - {t[0]}')

# Check if there's an app_settings or config table
cursor.execute("SHOW TABLES LIKE '%config%'")
config_tables = cursor.fetchall()
cursor.execute("SHOW TABLES LIKE '%setting%'")
setting_tables = cursor.fetchall()

print('\nConfig/Setting tables:')
for t in config_tables + setting_tables:
    print(f'  - {t[0]}')
    # Show structure
    cursor.execute(f"DESCRIBE {t[0]}")
    cols = cursor.fetchall()
    for col in cols:
        print(f'      {col[0]}: {col[1]}')

conn.close()
