Using SQL Alchemy, I’d like to know if it’s possible to get a list of all columns from any SQL query.
For example, if I call this query:
SELECT * FROM users;
I would need all the results, but also a list of all the columns from the table users.
I know I could hit the table Informations Schema, but my problem also affect any kind of query, like :
SELECT u.*, f.name, f.size FROM users u LEFT JOIN files f ON f.user_id = u.id;
I saw this option from SQL Alchemy, [column_description][1], but I don’t know if it works only for an ORM style ; I am using a non ORM style (I will write directly the queries).
Use
ResultProxy.keys():However, I agree with Mark that one should not use
SELECT *as a general rule.