src/quagen/db.py
def make_connection(retry=False):
    """
    Makes a new connection to the configred database.

    Args:
        retry (bool): In case of failure, keep retrying the connection every 5
        seconds until success.

    Returns:
        (Connection): Database connection
    """
    connection = None

    try:
        connection = psycopg2.connect(
            connect_timeout=1,
            user=config.SETTING_DB_USER,
            password=config.SETTING_DB_PASSWORD,
            host=config.SETTING_DB_HOST,
            port=config.SETTING_DB_PORT,
            database=config.SETTING_DB_NAME,
        )

    except psycopg2.OperationalError as error:
        if not retry:
            raise error

        logging.error("Error connecting to db. Trying reconnect in 5 seconds...")
        logging.debug(error)
        time.sleep(5)
        return make_connection(True)

    except (Exception, psycopg2.Error) as error:
        raise error

    return connection

    Makes a new connection to the configred database.

    Args:
        retry (bool): In case of failure, keep retrying the connection every 5
        seconds until success.

    Returns:
        (Connection): Database connection
    
Makes a new connection to the configred database.
Args:
retry (bool): In case of failure, keep retrying the connection every 5
seconds until success.

Database connection
Makes a new connection to the configred database . Args : retry ( bool ) : In case of failure keep retrying the connection every 5 seconds until success . Database connection
def make_connection(retry=False):
    connection = None
    try:
        connection = psycopg2.connect(
            connect_timeout=1,
            user=config.SETTING_DB_USER,
            password=config.SETTING_DB_PASSWORD,
            host=config.SETTING_DB_HOST,
            port=config.SETTING_DB_PORT,
            database=config.SETTING_DB_NAME,
        )
    except psycopg2.OperationalError as error:
        if not retry:
            raise error
        logging.error("Error connecting to db. Trying reconnect in 5 seconds...")
        logging.debug(error)
        time.sleep(5)
        return make_connection(True)
    except (Exception, psycopg2.Error) as error:
        raise error
    return connection
def make_connection ( retry = False ) : connection = None try : connection = psycopg2 . connect ( connect_timeout = 1 , user = config . SETTING_DB_USER , password = config . SETTING_DB_PASSWORD , host = config . SETTING_DB_HOST , port = config . SETTING_DB_PORT , database = config . SETTING_DB_NAME , ) except psycopg2 . OperationalError as error : if not retry : raise error logging . error ( "Error connecting to db. Trying reconnect in 5 seconds..." ) logging . debug ( error ) time . sleep ( 5 ) return make_connection ( True ) except ( Exception , psycopg2 . Error ) as error : raise error return connection
Makes a new connection to the configred database.
Makes a new connection to the configred database .
"""
    Makes a new connection to the configred database.

    Args:
        retry (bool): In case of failure, keep retrying the connection every 5
        seconds until success.

    Returns:
        (Connection): Database connection
    """
retry