Internal Class Representation
pgdbpool
- class pgdbpool.pool.Connection[source]
Bases:
object
Connection Class.
- classmethod init(config)[source]
Initialize “static” Class Instance.
- Parameters:
config (dict) – configuration data
- classmethod _init_class()[source]
Initialize “static” Class Instance.
setup global config data
setup groups (call _setup_groups())
- classmethod _setup_groups()[source]
Setup group Config / Iterator(s).
for each group, call _setup_connections(group_name)
- classmethod _setup_connections(group)[source]
Setup Connections per group.
- Parameters:
group (str) – group name
init DB connection for range (0, group.conn_count)
- classmethod get_max_pool_size(group)[source]
Get Connection-Pool size by group name.
- Parameters:
group (str) – group name
- Returns:
connection count
- Return type:
int
- classmethod get_connection_iter_container(group)[source]
Get Connection Iterator Container by group name.
- Parameters:
group (str) – group name
- Returns:
connection iterator
- Return type:
iterator
- classmethod get_connection_container(connection)[source]
Get Connection Container by Connection.
- Parameters:
connection (tuple) – (group name, group id)
- Returns:
connection tuple (conn object ref, conn status)
- Return type:
tuple
- classmethod get_connection_count(connection)[source]
Get Connection count by Connection.
- Parameters:
connection (tuple) – (group name, group id)
- Returns:
connection count
- Return type:
int
- classmethod set_connection_status(connection, status)[source]
Set Connection status.
- Parameters:
connection (tuple) – (group name, group id)
status (str) – occupied | free.
- classmethod get_next_connection(group)[source]
Get Iterators next() Connection by group name.
- Parameters:
group (str) – group name
- Returns:
connection object
- Return type:
object
- class pgdbpool.pool.Query[source]
Bases:
object
Query Class.
- static execute_prepared(connection, sql_params)[source]
Execute a System Prepared Query.
See https://github.com/WEBcodeX1/pg_extensions/tree/main/prep_queries.
- Parameters:
connection (tuple) – (group name, group id)
sql_params (str) – SQL stored procedure parameters