> On Dec 17, 2014, at 10:32 PM, jichao liu <liujichaoh...@gmail.com> wrote:
> 
> hello,
> in a scenario i  want query two table at once :
> 
> q = article_engine.execute('select * from table1;select * from table2')
>     for i in q:
>         print i.Name
> 
> how can i get data from the second table?

multiple statements in one execute() call are not recommended, and this is not 
a standard feature of the DBAPI.  If you need to get multiple result sets, 
you’ll want to use a DBAPI that supports this, and then use the nextset() API 
from a raw cursor, as illustrated at 
http://docs.sqlalchemy.org/en/rel_0_9/core/connections.html#multiple-result-sets
 
<http://docs.sqlalchemy.org/en/rel_0_9/core/connections.html#multiple-result-sets>.


> and how to use the orm select ,
> i only find the usage with engin/session.
> is there some way to use a Table.select(column=value) query?

are you referring to session.query()?   This has no support for multiple 
statements, but it does support calling upon specific columns, if that’s what 
you’re asking.



> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com 
> <mailto:sqlalchemy+unsubscr...@googlegroups.com>.
> To post to this group, send email to sqlalchemy@googlegroups.com 
> <mailto:sqlalchemy@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sqlalchemy 
> <http://groups.google.com/group/sqlalchemy>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to