copy and paste scripts:
Get field names:
[col.name for col in Table.__table__.columns]
Serialize a table (convert it to a JSON (python dictionary) by converting each record to a list that contains a dictionary holding key:value pairs of the field name and the data the cell holds eg. Table = [{id: 1, "name": "James", "dob": "1/2/2023", "age": 190}, {id: 2, "name": "Batholomew", "dob": "35/2/1066", "age": -9}]):
with app.app_context(): [{col.name: getattr(record, col) for col in Table.__table__.columns} for record in Table.query.all()]