Ejemplo n.º 1
0
 def __init__(self, db):
     if db == 'tts_tob_qly_v2':
         self.pool = ConnectionPool(**config1)
     elif db == 'tts_qly_analysis':
         self.pool = ConnectionPool(**config2)
     elif db == 'tts_douyin':
         self.pool = ConnectionPool(**config3)
     self.pool.connect()
Ejemplo n.º 2
0
def connection_pool():
    # Return a connection pool instance
    """
    with connection_pool().connection() as conn:
        cur = conn.cursor()
    #print(data)
    """
    pool = ConnectionPool(**config)
    pool.connect()
    return pool
Ejemplo n.º 3
0
    def get_vesync_database_connection_pool(
            database_info: dict) -> ConnectionPool:
        """
        Create database connection and return instance of connection.

        :return: instance of Pool
        """
        connection_pool = ConnectionPool(size=2,
                                         name='connection_pool',
                                         **database_info)
        return connection_pool
Ejemplo n.º 4
0
 def __init__(self,
              host='localhost',
              port=9306,
              user='',
              password='',
              database='',
              pool_name=None):
     self.__pool = ConnectionPool(host=host,
                                  port=port,
                                  user=user,
                                  password=password,
                                  database=database,
                                  pool_name=pool_name)
     self._host = host
     self._port = port
     self._user = user
     self._password = password
     self._database = database
     self._pool_name = pool_name
Ejemplo n.º 5
0
def connection_pool():
    # Return a connection pool instance
    pool = ConnectionPool(size=5, name='test', **config, autocommit=True)
    return pool
Ejemplo n.º 6
0
 def __init__(self, **dbConfig):
     self.pool = ConnectionPool(**dbConfig)
Ejemplo n.º 7
0
def connection_pool():
    # Return a connection pool instance
    pool = ConnectionPool(**config)
    # pool.connect()
    return pool
Ejemplo n.º 8
0
def connection_pool():
    pool = ConnectionPool(**dict(config.items("db")))
    return pool
Ejemplo n.º 9
0
def conn_pool():
    # pool = MySQLConnectionPool(**config)
    pool = ConnectionPool(**config)
    # pool.connect()
    # print(pool)
    return pool
Ejemplo n.º 10
0
def connection_pool():
	# return a connection pool instance
	pool = ConnectionPool(**config)
	return pool
Ejemplo n.º 11
0
def connection_pool():
    pool = ConnectionPool(**config)
    pool.connect()
    return pool