forked from Infra/risotto
tiramisu in postgres database
This commit is contained in:
@ -96,16 +96,8 @@ CREATE TABLE log(
|
||||
"""
|
||||
|
||||
async def main():
|
||||
db_conf = get_config().get('database')
|
||||
#asyncpg.connect('postgresql://postgres@localhost/test')
|
||||
engine = db_conf.get('engine')
|
||||
host = db_conf.get('host')
|
||||
dbname = db_conf.get('dbname')
|
||||
dbuser = db_conf.get('user')
|
||||
dbpassword = db_conf.get('password')
|
||||
dbport = db_conf.get('port')
|
||||
cfg = "{}://{}:{}@{}:{}/{}".format(engine, dbuser, dbpassword, host, dbport, dbname)
|
||||
pool = await asyncpg.create_pool(cfg)
|
||||
db_conf = get_config()['database']['dsn']
|
||||
pool = await asyncpg.create_pool(db_conf)
|
||||
async with pool.acquire() as connection:
|
||||
async with connection.transaction():
|
||||
returns = await connection.execute(VERSION_INIT)
|
||||
|
Reference in New Issue
Block a user