Ok. I ran the script 10 times on a clean table. Now I run raw sql: SELECT * FROM test_user WHERE (last_receive_time + INTERVAL '1 second' * timeout) < NOW();
The result: 10 records. Now I run script one more time. Still 0 records using from_statement. amount records using NOW() = 0 As I understand it, is this correct? This is just unclear because from_statement + text works not like raw query. On Tue, Jun 26, 2018 at 7:42 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > definitely, triyng to match up python .now() with database .now() is > not going to work, in particular since .now() in the database is often > the transaction start time, not the actual time. > > On Tue, Jun 26, 2018 at 12:28 PM, Jonathan Vanasco > <jonat...@findmeon.com> wrote: > > the difference is possibly because this is calculated in Python, each > time > > it is executed: > > > > datetime.datetime.now() > > > > this is calculated in Postgres, and refers to the beginning of the > > transaction; it does not change across the transaction. > > > > NOW() > > > > -- > > 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 post to this group, send email to sqlalchemy@googlegroups.com. > > Visit this group at https://groups.google.com/group/sqlalchemy. > > For more options, visit https://groups.google.com/d/optout. > > -- > 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 post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.