def __init__(self, host, database, user, autocommit=True, pool=PostgresPool,
default_schema='public'):
"""
Instantiate class from given SourceDb entry (one row in the datasource table)
:param host: Host address (domain or IP)
:param database: Name of the database
:param user: User
"""
self.user = user
self.hostname = host
self.dbname = database
# the password is taken from ~/.pgpass
if self.dbname not in self.connection_pools:
self.connection_pools[self.dbname] = pool(autocommit=autocommit,
minconn=1,
maxconn=5,
user=self.user,
host=self.hostname,
database=self.dbname,
default_schema=default_schema,
connect_timeout=config.DB_CONNECT_TIMEOUT)
评论列表
文章目录