260710_0
This commit is contained in:
+82
@@ -0,0 +1,82 @@
|
||||
"""DB 상태 확인 스크립트."""
|
||||
|
||||
import asyncio
|
||||
import aiomysql
|
||||
|
||||
|
||||
async def check_db():
|
||||
"""DB 테이블 목록 및 구조 확인."""
|
||||
conn = await aiomysql.connect(
|
||||
host="dsm.chemifactory.com",
|
||||
port=53306,
|
||||
user="ctnt_root",
|
||||
password="Umsang6595!!",
|
||||
db="aislo_db",
|
||||
charset="utf8mb4",
|
||||
)
|
||||
|
||||
try:
|
||||
async with conn.cursor() as cur:
|
||||
# 1. 테이블 목록
|
||||
print("=" * 60)
|
||||
print("【존재하는 테이블】")
|
||||
print("=" * 60)
|
||||
await cur.execute("SHOW TABLES")
|
||||
tables = await cur.fetchall()
|
||||
for (table_name,) in tables:
|
||||
print(f" - {table_name}")
|
||||
|
||||
# 2. upload_sessions 테이블 확인
|
||||
print("\n" + "=" * 60)
|
||||
print("【upload_sessions 테이블 구조】")
|
||||
print("=" * 60)
|
||||
try:
|
||||
await cur.execute("DESCRIBE upload_sessions")
|
||||
columns = await cur.fetchall()
|
||||
for row in columns:
|
||||
print(f" {row}")
|
||||
except Exception as e:
|
||||
print(f" ❌ 테이블 없음: {e}")
|
||||
|
||||
# 3. upload_chunks 테이블 확인
|
||||
print("\n" + "=" * 60)
|
||||
print("【upload_chunks 테이블 구조】")
|
||||
print("=" * 60)
|
||||
try:
|
||||
await cur.execute("DESCRIBE upload_chunks")
|
||||
columns = await cur.fetchall()
|
||||
for row in columns:
|
||||
print(f" {row}")
|
||||
except Exception as e:
|
||||
print(f" ❌ 테이블 없음: {e}")
|
||||
|
||||
# 4. input_files 테이블 확인
|
||||
print("\n" + "=" * 60)
|
||||
print("【input_files 테이블 구조】")
|
||||
print("=" * 60)
|
||||
try:
|
||||
await cur.execute("DESCRIBE input_files")
|
||||
columns = await cur.fetchall()
|
||||
for row in columns:
|
||||
print(f" {row}")
|
||||
except Exception as e:
|
||||
print(f" ❌ 테이블 없음: {e}")
|
||||
|
||||
# 5. projects 테이블 확인
|
||||
print("\n" + "=" * 60)
|
||||
print("【projects 테이블 구조】")
|
||||
print("=" * 60)
|
||||
try:
|
||||
await cur.execute("DESCRIBE projects")
|
||||
columns = await cur.fetchall()
|
||||
for row in columns:
|
||||
print(f" {row}")
|
||||
except Exception as e:
|
||||
print(f" ❌ 테이블 없음: {e}")
|
||||
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(check_db())
|
||||
Reference in New Issue
Block a user