Here are the examples of the python api sqlalchemy.func.datetime taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
View Complete Implementation : promnesia_server.py
Copyright MIT License
Author : karlicoss
Copyright MIT License
Author : karlicoss
@hug.local()
@hug.post('/search_around')
def search_around(
timestamp: T.number,
):
delta_back = timedelta(hours=3).total_seconds()
delta_front = timedelta(minutes=5).total_seconds()
# TODO not sure about front.. but it also serves as quick hack to accomodate for all the truncations etc
return search_common(
url='http://dummy.org', # TODO remove it from search_common
# TODO no abs?
where=lambda table, url: between(
func.strftime('%s', func.datetime(table.c.dt)) - literal(timestamp),
literal(-delta_back),
literal(delta_front),
),
)
3
View Complete Implementation : test_sqlite.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_render_server_default_expr_needs_parens(self):
c = Column(
"date_value",
DateTime(),
server_default=func.datetime("now", "localtime"),
)
result = autogenerate.render._render_column(c, self.autogen_context)
eq_ignore_whitespace(
result,
"sa.Column('date_value', sa.DateTime(), "
"server_default=sa.text(!U\"(datetime('now', 'localtime'))\"), "
"nullable=True)",
)
0
View Complete Implementation : test_sqlite.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.sqlalchemy_12
def test_compare_current_timestamp_func(self):
self._compare_default_roundtrip(
DateTime(), func.datetime("now", "localtime")
)