How could I print column name and their values using SQLAlchemy in python?
For ex: I have a USER table, which contains 2 fields ID & NAME.
ID NAME
1 John
2 Stella
I need something similar to this mysql query: select id as User_ID from USER where id = '1';
Currently, I am using the following query to get just the values:
meta = MetaData(engine)
users = Table('USER', meta, autoload=True)
selectQuery = select([users.c.ID, users.c.NAME]).where(users.c.ID == '1')
Executing above query I am getting:
('1', 'John')
Instead I need this:
ID NAME
1 John