Closed vinodMS closed 4 years ago
Quick and dirty but does the job, I think, assuming session
is your table name:
import pickle
[
dict(
row_id=row[0],
session_id=row[1],
session=pickle.loads(bytes(row[2])),
expiry=row[3]
)
for row in db.session.execute('SELECT * FROM session')
]
(Might possibly want to pass an encoding
parameter to pickle.loads()
depending on what's in your session too — IIRC the default encoding is ascii
whereas utf-8
might be more suitable...)
I'd like to access the db model to be able to query it and retrieve all the records.