>>> from sqlalchemy.sql.expression import func
>>> from sqlalchemy import func as other_func
>>> func == other_func
True


2012/3/8 Timuçin Kızılay <t...@savaskarsitlari.org>:
> Thank you. it works now.
>
> But what is the difference between
>
> from sqlalchemy.sql.expression import func
> and
> from sqlalchemy import func
>
> the second import is what I found out while experimenting with the query and
> after I saw your reply, I tried your code and both works the same.
>
>
>
>
> On 08-03-2012 12:39, Robert Forkel wrote:
>>
>> sqlalchemy.sql.expression.func may work for this:
>>
>> from sqlalchemy.sql.expression import func
>>
>> ...
>> q_doc.filter(func.substring(model.Doc.FileNameStr, 22, 1)==search_str)
>> ...
>>
>> 2012/3/8 Timuçin Kızılay<t...@savaskarsitlari.org>:
>>>
>>> I have a query contains SUBSTRING in where clause:
>>>
>>> Select top 100 * from _Doc
>>> where SUBSTRING(_Doc.FileNameStr, 22, 1) = '2'
>>> ---
>>> This query runs on mssql but I need to use that query from sa.
>>> I could not find anything like this in SA documentatin.
>>>
>>> Here is what I tried so far:
>>>
>>>    q_doc = dbsession.query(model.Doc)
>>>    q_doc = q_doc.filter(model.Doc.DocID>= ilk).filter(model.Doc.DocID<=
>>> son)
>>>    q_doc = q_doc.filter(model.Doc.FileNameStr[21] == search_str)
>>>    q_doc = q_doc.order_by(model.Doc.DocID)
>>>
>>> of course, that gives errors.
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "sqlalchemy" group.
>>> To post to this group, send email to sqlalchemy@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> sqlalchemy+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/sqlalchemy?hl=en.
>>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to