Please try:
query = Expression(db,"interval_time < (strftime('%M','now') -
strftime('%M', updated_on))")
On the page suggested by Niphlod we read:
Compute the number of seconds between two dates:
SELECT strftime('%s','now') - strftime('%s','2004-01-01 02:34:56');
So by replacing '%s' with '%M' we obtain the difference in minutes between
two dates.
Il giorno mercoledì 14 novembre 2012 12:13:03 UTC+1, Amit ha scritto:
>
> 100% correct :) , now facing problem of replacing the query with sqlite
> compatible query :
>
> MySql query were:
>
> *query = Expression(db,"date_sub(now(),interval interval_time minute) >
> updated_on")*
>
> where interval_time field is integer field which will be considered to
> take interval in minutes for e.g. if user wants to save the interval time
> is 1 hour then he has to enter it in minutes means 60 minutes.
>
> Now problem is when i tried to replace the above query with sqlite
> compitible query like below and pass to the db to get the required records:
>
> *query = Expression(db,"date('now','-interval_time minutes') >
> updated_on")*
>
> it returns nothing.
> So can you please help me out write the above query in Sqlite.
>
> Thanks,
> Amit
>
>
>
> On Wed, Nov 14, 2012 at 3:36 PM, Niphlod <[email protected]
> <javascript:>>wrote:
>
>>
>> Il giorno mercoledì 14 novembre 2012 09:51:43 UTC+1, Amit ha scritto:
>>
>>> Hi,
>>> I am getting error
>>> *<class 'sqlite3.OperationalError'> near "interval_time": syntax error*
>>>
>>
>> syntax error points to something around "interval_time"...... my bet is
>> on date_sub() not supported by sqlite
>>
>> http://www.sqlite.org/cvstrac/wiki/wiki?p=DateAndTimeFunctions
>>
>>
>> --
>>
>>
>>
>>
>
>
--