I have created a database in PlanetScalse and used MySql workbench to connect and create a simple table to use with my flask web application.
I am using Replit to build code and this is the python code I am writing to get the table using sqlalchemy -
from sqlalchemy import create_engine, text
db_connection_string= "mysql+pymysql://myusername:mypassword@mypasword/mydbname?charset=utf8mb4"
engine = create_engine(
db_connection_string,
connect_args = {
"ssl" : {
"ssl_ca": "/etc/ssl/cert.pem"
}
})
with engine.connect() as conn:
result = conn.execute(text("select * from jobs"))
jobs = []
for row in result.all():
jobs.append(dict(row))
print(type(result_all[0]))
The error is TypeError: cannot convert dictionary update sequence element #0 to a sequence
I want to convert the table data into list of dictionaries as'
[{'id':1. 'title': 'Resume', 'price': 'Free', 'features': 'Uploading your resume provides several benefits such as: Allowing employers to easily access your professional experience and qualifications, increasing your visibility to potential job opportunities, and providing a more streamlined application process when applying to jobs online.',{'id':'2', ... and so on
I did search stack overflow and internet and looked and tried other solutions such as .__dict__
and others but none are working
Please help!