db/python/connect.py
def prepare_connection_string(
        host,
        database,
        username,
        password=None,
        port=None,
        # min_pool_size=5,
        # max_pool_size=20,
    ):
        """Prepares the connection string for mysql / mariadb"""

        _host = host or 'localhost'
        u_p = username

        if password:
            u_p += f':{password}'
        if port:
            _host += f':{port}'

        options = {}  # {'min_size': min_pool_size, 'max_size': max_pool_size}
        _options = '&'.join(f'{k}={v}' for k, v in options.items())

        url = f'mysql://{u_p}@{_host}/{database}?{_options}'

        return url
Prepares the connection string for mysql / mariadb
Prepares the connection string for mysql / mariadb
Prepares the connection string for mysql / mariadb
def prepare_connection_string(
        host,
        database,
        username,
        password=None,
        port=None,
    ):
        _host = host or 'localhost'
        u_p = username
        if password:
            u_p += f':{password}'
        if port:
            _host += f':{port}'
        options = {}  
        _options = '&'.join(f'{k}={v}' for k, v in options.items())
        url = f'mysql://{u_p}@{_host}/{database}?{_options}'
        return url
def prepare_connection_string ( host , database , username , password = None , port = None , ) : _host = host or 'localhost' u_p = username if password : u_p += f':{password}' if port : _host += f':{port}' options = { } _options = '&' . join ( f'{k}={v}' for k , v in options . items ( ) ) url = f'mysql://{u_p}@{_host}/{database}?{_options}' return url
Prepares the connection string for mysql / mariadb
Prepares the connection string for mysql / mariadb
# min_pool_size=5, # max_pool_size=20, """Prepares the connection string for mysql / mariadb""" # {'min_size': min_pool_size, 'max_size': max_pool_size}
host
database
username
password
port