server.web.utils.time_sql

Time-based SQL expression utilities.

Functions

add_time_expr(→ Any)

Create a SQL expression to add time (in seconds) to the current timestamp.

subtract_time_expr(→ Any)

Create a SQL expression to subtract time (in seconds) from the current timestamp.

Module Contents

server.web.utils.time_sql.add_time_expr(delta: float, dialect: str) Any

Create a SQL expression to add time (in seconds) to the current timestamp.

Parameters:
  • delta – Number of seconds to add

  • dialect – The database dialect (mysql, sqlite)

Returns:

A SQLAlchemy expression appropriate for the current dialect

Raises:

ServerError – If the dialect is not supported

server.web.utils.time_sql.subtract_time_expr(delta: float, dialect: str) Any

Create a SQL expression to subtract time (in seconds) from the current timestamp.

Parameters:
  • delta – Number of seconds to subtract

  • dialect – The database dialect (mysql, sqlite)

Returns:

A SQLAlchemy expression appropriate for the current dialect

Raises:

ServerError – If the dialect is not supported