I need to build a Tkinter desktop app with Sqlalchemy as a database. If I read the SQLite database, and print both the header and content of database as show as below:
What I have tried:
<pre lang="SQL">
from sqlalchemy import text, create_engine
engine = create_engine("sqlite:///my_db.db")
my_conn = engine.connect()
with engine.connect() as my_conn:
content = my_conn.execute(text("SELECT * FROM student_address LIMIT 10"))
header = [r for r in content.keys()]
content = [list(r) for r in content]
value = [header, content]
print(value)
<pre>
The result:
[['id', 'name', 'class', 'mark', 'gender', 'hostel', 'address'],
[[1, 'Kelvin Loh', 'Six', 'Male', '45', '1', 'ffff\n']]]
# 3D array instead of 2D array
but what I need:
[['id', 'name', 'class', 'mark', 'gender', 'hostel', 'address'],
[1, 'Kelvin Loh', 'Six', 'Male', '45', '1', 'ffff\n']]
I whant the value show in CTKtable value=value.
How could I fix it?