Great, it works.
Thank you very much.

Regards,
Michal

On Tuesday, December 1, 2015 at 6:49:05 PM UTC+1, Jonathan Vanasco wrote:
>
> I don't think you can get that exact query staying within the ORM's 
> cross-platform functionality -- I don't think there is anything that can 
> generate the `::` version of casting... but I think something like this 
> should produce the same output:
>
> r = session.query( Device.id, Device.name, Device.details )\
>     .filter( sqlalchemy.sql.expression.cast(Device.details, 
> sqlalchemy.types.String).like('99') )\
>     .all()
>
> I'm doing this from memory, so i could be off -- but the general idea is 
> that you'll `cast` into a `String`, and then run the `like` operator on 
> that column.  The API docs will have the correct format.
>
>
> That should generate something like :
>
>    + SELECT id,name,details FROM Device WHERE cast(details as text) LIKE 
> '%99%';
>
> Instead of:
>
>    - SELECT id,name,details FROM Device WHERE details::text LIKE '%99%';
>
> If you need to use the `details::text` format, you could use a text 
> literal in the WHERE clause.  see 
> http://docs.sqlalchemy.org/en/latest/orm/tutorial.html#using-textual-sql
>
>

-- 
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