I’m getting more comfortable with Flask, so I decided to experiment with Google App Engine + Flask + HandsOnTable.
I made a small app that takes the contents of the 2nd column and matches it to the rows of the first column. I’ve found myself doing this a few times by manually creating two python lists and comparing them in IDLE, so it saves me that work.
Rob Wouter’s answer really helped me out: result.keys() gives you the column names, and each row’s columns and values are on row._mapping (SQLAlchemy 2.0 moved them off the row itself):
fromsqlalchemyimportcreate_engine,textengine=create_engine("sqlite:///example.db")withengine.connect()asconn:result=conn.execute(text("SELECT * FROM users"))print(list(result.keys()))# ['id', 'name', 'email']
forrowinresult:forcolumn,valueinrow._mapping.items():print(f"{column}: {value}")
Make sure you have a row id number as your primary key for your child table. Having a composite primary key didn’t seem to save when I was editing the form.