How to retrieve python list of SQLAlchemy result set? -
I have the following questions to get a column of data:
routes_query = Select ([Schema.stop_times.c.route_number], schema.stop_times.c.stop_id == stop_id) .distinct (schema.stop_times.c.route_number) results = conn.execute (routes_query) returns [r ['route_number' ] Results in R]] I'm thinking that data is a cleaner way to bring back the original list of rows.
1-element is the shortest way to draw the list of tuples in the list: < Pre> result = [r [0] for result in R] or:
result = [r for r, result In]
Comments
Post a Comment