Skip to content

Module src.db_connection

Classes

Database

class Database(

)

Handles the all work related to connection pooling

Methods

close_all_connection_pool

def close_all_connection_pool(
    self
)
Closes the connection thread created by thread pooling all at once

connect

def connect(
    self
)
Connection to the database

get_conn_from_pool

def get_conn_from_pool(
    self
)
Function to get connection from the pool instead of new connection

Returns: connection

release_conn_from_pool

def release_conn_from_pool(
    self,
    pool_con
)
Can be used to release specific connection after its use from the pool , so that it can be used by another process

Args: pool_con (type): define which connection to remove from pool

Raises: ex: error if connection doesnot exists or misbehave of function