summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-02-16 18:11:00 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-02-16 18:11:00 +0100
commit9638fe930b4252d306389b5a27ce942614906db7 (patch)
treec8e355d8d6c9ce82e3bca6f5b11a82eaa2969be9
parent07f17264500c388cb039eb33cdd89bc4f54d9505 (diff)
downloadshrinker-9638fe930b4252d306389b5a27ce942614906db7.tar.gz
shrinker-9638fe930b4252d306389b5a27ce942614906db7.zip
fail on SQL errors
-rw-r--r--api.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/api.py b/api.py
index d42c2aa..c7ae8f7 100644
--- a/api.py
+++ b/api.py
@@ -57,13 +57,8 @@ class Processor(object):
stop_after -= 1 # TODO for debugging, don't process whole table
async with srccon.transaction():
async with destcon.transaction():
- rec_o = ""
- try:
- async for rec in srccon.cursor(query):
- rec_o = rec
- await self.into(destcon, rec, table)
- except:
- logging.error("rec: %s", rec_o)
+ async for rec in srccon.cursor(query):
+ await self.into(destcon, rec, table)
async def into(self, conn, data, table):
"""Insert a named tuple into a table."""
@@ -72,11 +67,7 @@ class Processor(object):
placeholders = ["${}".format(i) for i, _ in enumerate(values, 1)]
query = "INSERT INTO {} (\"{}\") VALUES ({})".format(
table, "\", \"".join(keys), ", ".join(placeholders))
- try:
- await conn.execute(query, (*data))
- except:
- logging.error("Query: '%s'", query)
- logging.error("Data: '%s'", data)
+ await conn.execute(query, (*data))
async def main():