mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
26 lines
571 B
Python
26 lines
571 B
Python
import sqlite3
|
|
|
|
conn = sqlite3.connect('data/xiaozhi_memory.db')
|
|
cursor = conn.cursor()
|
|
|
|
# Get column names
|
|
cursor.execute('PRAGMA table_info(memories)')
|
|
cols = [c[1] for c in cursor.fetchall()]
|
|
|
|
# Get all records
|
|
cursor.execute('SELECT * FROM memories')
|
|
rows = cursor.fetchall()
|
|
|
|
print(f'Total records: {len(rows)}')
|
|
print()
|
|
|
|
if rows:
|
|
for row in rows:
|
|
print(dict(zip(cols, row)))
|
|
print('-' * 50)
|
|
else:
|
|
print('No memories found. Database is empty.')
|
|
print()
|
|
print('Memories will be saved after the first conversation ends.')
|
|
|
|
conn.close()
|