database script

This commit is contained in:
Emmanuel Garette 2020-03-06 07:33:20 +01:00
parent b39aac8fd2
commit 27f145cd6d
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import asyncpg import asyncpg
import asyncio import asyncio
from os.path import isfile from os.path import isfile
from sys import init from sys import exit
from risotto.config import get_config from risotto.config import get_config
@ -17,7 +17,7 @@ async def main():
async with pool.acquire() as connection: async with pool.acquire() as connection:
async with connection.transaction(): async with connection.transaction():
with open(sql_filename, 'r') as sql: with open(sql_filename, 'r') as sql:
await connection.execute(sql.read().decode()) await connection.execute(sql.read())
if __name__ == '__main__': if __name__ == '__main__':
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()