On Mon, Oct 7, 2019 at 11:24 AM Mirek Morek <testere...@gmail.com> 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/CAFHwexeuXkQFxpHxKPcmhYWYm190UudK1062mv5UbRT5keg9Xw%40mail.gmail.com.

Reply via email to