blob: de4895ed3f60efa9aa1e3ac6de23fb33e3336504 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#!/usr/bin/python
import asyncio
import glob
import os
import asyncpg
queries = dict()
async def load_queries(path):
"""Prepares a folder of SQL files as SQL statements.
:param path: Path to the `.sql` files.
:type path: str
"""
# load from queries/
queryfiles = glob.glob(path + "/*.sql")
for fp in queryfiles:
with open(fp, "r") as qfile:
name = os.path.splitext(os.path.basename(fp))[0]
queries[name] = qfile.read()
|