Yes, thanks, I tried that, but I receive:

*ArgumentError: columns argument to select() must be a Python list or other 
iterable*


W dniu poniedziałek, 7 października 2019 12:36:03 UTC+2 użytkownik Simon 
King napisał:
>
> On Mon, Oct 7, 2019 at 11:24 AM Mirek Morek <teste...@gmail.com 
> <javascript:>> wrote:
>
>> Hello,
>> I have a following question:
>>
>> I have a python method which should get field value from a table.
>>
>>
>> I would like it to work like this:
>>
>> I pass method with parameters: *"select flight track field value    10 
>>    cat"*
>>
>> Then it execute following query:
>>
>> query = select([FLIGHT_TRACK.c.*cat*]).\
>>     where(FLIGHT_TRACK.c.flight_track_sys_id == *10*).\
>>     order_by(desc(FLIGHT_TRACK.c.committed_timestamp))
>>
>> But currently it doesn't 'see' column_name parameter as a column name 
>> from Flight Track table. 
>> How can I make it to use it like expected?
>>
>> Thanks a lot. Regards.
>>
>  
> The ".c" attribute on a table allows dictionary-style access:
>
>
> https://docs.sqlalchemy.org/en/13/core/metadata.html#accessing-tables-and-columns
>
> so you should be able to use
>
> FLIGHT_TRACK.c[column_name]
>
> Hope that helps,
>
> Simon
>
>

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/6d679fcb-ab12-4f96-87d5-860a99f5ca1e%40googlegroups.com.

Reply via email to