buildgrid.server.sql.sqlutils module

buildgrid.server.sql.sqlutils.is_sqlite_connection_string(connection_string: str) bool
buildgrid.server.sql.sqlutils.is_psycopg2_connection_string(connection_string: str) bool
buildgrid.server.sql.sqlutils.is_sqlite_inmemory_connection_string(full_connection_string: str) bool
class buildgrid.server.sql.sqlutils.SQLPoolDisposeHelper(cooldown_time_in_secs: int, cooldown_jitter_base_in_secs: int, min_time_between_dispose_in_minutes: int, sql_engine: Engine)

Bases: object

Helper class for disposing of SQL session connections

check_dispose_pool(session: Session, e: Exception) bool

For selected exceptions invalidate the SQL session - returns True when a transient sql connection error is detected - returns False otherwise

time_until_active_pool() timedelta

The time at which the pool is expected to become active after a pool disposal. This adds small amounts of jitter to help spread out load due to retrying clients