24 lines
645 B
Python
24 lines
645 B
Python
import sys
|
|
import os
|
|
sys.path.append(os.getcwd())
|
|
|
|
from Controller.DouYinController import get_db_connection
|
|
|
|
def check_db():
|
|
try:
|
|
conn = get_db_connection()
|
|
cursor = conn.cursor()
|
|
cursor.execute("SELECT count(*) as cnt FROM t_douyin_record")
|
|
count = cursor.fetchone()
|
|
print(f"Total records: {count}")
|
|
|
|
cursor.execute("SELECT * FROM t_douyin_record ORDER BY create_time DESC LIMIT 5")
|
|
records = cursor.fetchall()
|
|
print(f"Recent records: {records}")
|
|
conn.close()
|
|
except Exception as e:
|
|
print(f"Error: {e}")
|
|
|
|
if __name__ == "__main__":
|
|
check_db()
|