tiramisu in postgres database

This commit is contained in:
2020-01-30 16:22:06 +01:00
parent 5666c01bdc
commit 6bdf21d1ac
12 changed files with 110 additions and 114 deletions

View File

@ -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)

View File

@ -1,6 +1,7 @@
from asyncio import get_event_loop
from risotto import get_app
if __name__ == '__main__':
loop = get_event_loop()
loop.run_until_complete(get_app(loop))
@ -8,5 +9,3 @@ if __name__ == '__main__':
loop.run_forever()
except KeyboardInterrupt:
pass