import oracledb

conn = oracledb.connect(user='AGWAPP', password='elink1234', dsn='192.168.240.177:1598/DAPM')
cursor = conn.cursor()

cursor.execute("SELECT TABLE_NAME, STATUS FROM DBA_TABLES WHERE OWNER = 'AGWAPP' AND TABLE_NAME LIKE 'API_STATS%' ORDER BY TABLE_NAME")
for row in cursor.fetchall():
    print(f"  {row[0]}  ({row[1]})")

cursor.close()
conn.close()
