diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-10 17:00:51 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-10 17:00:51 +0100 |
| commit | 901b7bfc18d1351fc398a79b62dda93b4e247011 (patch) | |
| tree | a72d25f30f2bb2cc2c52036b421c4fb565d406c6 | |
| parent | d0c7a6ef3b7f04faf6ea977cf2f22bc5eb7c5f79 (diff) | |
| download | compiler-901b7bfc18d1351fc398a79b62dda93b4e247011.tar.gz compiler-901b7bfc18d1351fc398a79b62dda93b4e247011.zip | |
cache statements
| -rw-r--r-- | api.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -47,10 +47,11 @@ class Compiler(joblib.worker.Worker): # directory names: web target table table = os.path.basename(os.path.dirname(path)) with open(path, "r", encoding="utf-8-sig") as file: + qry = await self._con.prepare(file.read()) try: - self._queries[table].append(file.read()) + self._queries[table].append(qry) except KeyError: - self._queries[table] = [file.read()] + self._queries[table] = [qry] logging.info("loaded query '%s'", table) @@ -74,7 +75,7 @@ class Compiler(joblib.worker.Worker): jobid, object_id, table) for query in self._queries[table]: try: - await self._con.execute(query, object_id) + await query.fetch(object_id) except asyncpg.exceptions.DeadlockDetectedError: logging.error("%s: deadlocked!", jobid) raise joblib.worker.JobFailed("deadlock", |
