进行了 GVSDSDK 迁移,可能存在诸多问题
This commit is contained in:
19
check_table_rows.py
Normal file
19
check_table_rows.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
"""检查数据库表行数"""
|
||||
import MySQLdb
|
||||
from app_secrets import DATABASE_HOST, DATABASE_PORT, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME
|
||||
|
||||
conn = MySQLdb.connect(
|
||||
host=DATABASE_HOST, port=int(DATABASE_PORT),
|
||||
user=DATABASE_USER, password=DATABASE_PASSWORD,
|
||||
database=DATABASE_NAME
|
||||
)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute(
|
||||
"SELECT TABLE_NAME, TABLE_ROWS FROM information_schema.TABLES "
|
||||
"WHERE TABLE_SCHEMA = %s ORDER BY TABLE_NAME",
|
||||
[DATABASE_NAME]
|
||||
)
|
||||
for row in cursor.fetchall():
|
||||
print(f"{row[0]:40s} {row[1]}")
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user