did you try:

order_by(*t.primary_key)

?



On Sun, Jan 5, 2020, at 7:02 PM, sumau wrote:
> Hello
> 
> I was wondering if it was possible to sort a table by its 'unspecified' 
> primary keys using the SQL Alchemy Expression Language?
> 
> I have tried the following:
> 
> t = Table ('test',metadata,autoload=True)
> select([t]).order_by(t.primary_key.columns)
> 
> but I get the following error:
> 
> sqlalchemy.exc.ArgumentError: SQL expression object expected, got object of 
> type <class 'sqlalchemy.sql.base.ColumnCollection'> instead
> 
> nRegards
> Soumaya
> 

> --
>  SQLAlchemy - 
>  The Python SQL Toolkit and Object Relational Mapper
> 
> http://www.sqlalchemy.org/
> 
>  To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
>  --- 
>  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 [email protected].
>  To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/c20800c0-e715-4d49-839e-6952f0dc690d%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/c20800c0-e715-4d49-839e-6952f0dc690d%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/1f6b835b-44fa-4413-95ac-3995be0b6807%40www.fastmail.com.

Reply via email to