34 lines
942 B
Python
34 lines
942 B
Python
import sqlite3
|
|
|
|
def check_database():
|
|
conn = sqlite3.connect('fault_codes.db')
|
|
cursor = conn.cursor()
|
|
|
|
# 테이블 목록 확인
|
|
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
|
|
tables = cursor.fetchall()
|
|
print("테이블 목록:", tables)
|
|
|
|
# woojin200 테이블의 데이터 확인
|
|
cursor.execute("SELECT * FROM woojin200 LIMIT 5;")
|
|
rows = cursor.fetchall()
|
|
print("\n첫 5개 데이터:")
|
|
for row in rows:
|
|
print(row)
|
|
|
|
# 전체 데이터 개수 확인
|
|
cursor.execute("SELECT COUNT(*) FROM woojin200;")
|
|
count = cursor.fetchone()[0]
|
|
print(f"\n전체 데이터 개수: {count}")
|
|
|
|
# 테이블 구조 확인
|
|
cursor.execute("PRAGMA table_info(woojin200);")
|
|
columns = cursor.fetchall()
|
|
print("\n테이블 구조:")
|
|
for col in columns:
|
|
print(col)
|
|
|
|
conn.close()
|
|
|
|
if __name__ == "__main__":
|
|
check_database() |