maxi wrote:
> Hi,
>
> Are there any approach to get columns names from query result ?
>
> I'm executing a dynamic sql statemet using text function and execute.
>
> s = 'select * from foo where foo.name like = :name'
> txt = text(s, bind=database.metadata.bind)
> p = {'name':u'some name'}
> result = txt.execute(p).fetchall()
>
> Now, I need something like...
>
> result.get_columns_names()
>
> Thanks in advance.
>
The ResultProxy returned by execute has a keys attribute.
>>> e = sa.create_engine('postgres:///test1')
>>> rp = e.execute('select * from customers')
>>> rp.keys
[u'id', u'name']
--Randall
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---