I recently had exactly the same problem on SQLAlchemy 0.8 where doing 
something like "somestring" + Item.some_column would not result in a "||" 
but in a "+" operator which sqlite could not handle. To note here in my 
case: The "some_column" was the id, thus an integer. I'm not sure how 
SQLAlchemy handles the operators exactly, but could this be a bug? Or is it 
intended behaviour?

On Thursday, August 29, 2013 8:58:55 PM UTC+2, Gunnlaugur Briem wrote:
>
> I would have expected the SQLite dialect to know how to compile concat to 
> || if that's the operator. But failing that, something more explicit like 
> this ought to do the trick:
>
> from sqlalchemy.sql import literal_column
> literal_column("'+ '").op('||')(seconds.c.n).op('||')(literal_column("' 
> seconds'"))
>
> Gulli
>
>
>
> On Thu, Aug 29, 2013 at 12:33 PM, Greg Yang <[email protected]<javascript:>
> > wrote:
>
>> I'm trying to get a series of datetimes using func.datetime. The format 
>> of input is func.datetime(basetime, '+ NNN seconds'), which works nicely if 
>> the shift applied is constant. However I need to add 10, 20, 30 seconds, 
>> etc to this base time. So I want something like func.datetime(basetime, 
>> concat('+', seconds.c.n, ' seconds')), but concat doesn't work for sqlite, 
>> which concatenates using the '||' operator. Is there working method to 
>> concat in sqlite?
>>
>> Failing that, is there another way to get at what I want with datetime 
>> arithmetics?
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to