For completeness sake, here is how you'd generate that exact SQL with using sqlalchemy.sql.func
:
from sqlalchemy.sql import func
from sqlalchemy.sql.expression import bindparam
from sqlalchemy import Interval
tomorrow = func.dateadd(func.now(), bindparam('tomorrow', timedelta(days=1), Interval()))
which results in:
>>> from sqlalchemy.sql import func
>>> func.dateadd(func.now(), bindparam('tomorrow', timedelta(days=1), Interval(native=True)))
<sqlalchemy.sql.expression.Function at 0x100f559d0; dateadd>
>>> str(func.dateadd(func.now(), bindparam('tomorrow', timedelta(days=1), Interval(native=True))))
'dateadd(now(), :tomorrow)'
Alternatively you could use a text()
object to specify the interval instead:
from sqlalchemy.sql import func
from sqlalchemy.sql.expression import text
tomorrow = func.dateadd(func.now(), text('interval 1 day'))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…