I’m trying to use the new SQLAlchemy session.execute
call, instead of session.query
. But I can’t figure out how to get the individual fields
session = get_session(engine)
query = select(City)
cities = session.execute(query)
for city in cities:
print('city', city) <== This prints out a whole row
print(city.name) <== This throws an error, as does city['name']
The documentation isn’t very clear