diff options
| author | Kapil Viren Ahuja <k.v.ahuja@gmail.com> | 2017-03-04 11:42:14 +0530 |
|---|---|---|
| committer | Kapil Viren Ahuja <k.v.ahuja@gmail.com> | 2017-03-04 11:42:14 +0530 |
| commit | 2ba860f0452ce4147b845db75d79014d059c27ec (patch) | |
| tree | 141ed9c17862f6aef78782ba815afce41af1bcac /api.py | |
| parent | e84c88441ed7e455ad708b8c3246046f0f400f00 (diff) | |
| download | shrinker-2ba860f0452ce4147b845db75d79014d059c27ec.tar.gz shrinker-2ba860f0452ce4147b845db75d79014d059c27ec.zip | |
Col case changes
Diffstat (limited to 'api.py')
| -rw-r--r-- | api.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -126,9 +126,9 @@ class Worker(object): query = """ INSERT INTO player ("{0}", "lastMatchCreatedDate") VALUES ({1}, 'epoch'::timestamp) - ON CONFLICT("apiId") DO UPDATE SET ("{0}") = ({1}) + ON CONFLICT("api_id") DO UPDATE SET ("{0}") = ({1}) WHERE player.played < EXCLUDED.played - RETURNING "apiId" + RETURNING "api_id" """.format( "\", \"".join(keys), ", ".join(placeholders)) objid = await conn.fetchval(query, *data.values()) @@ -149,8 +149,10 @@ class Worker(object): items = list(data.items()) keys, values = [x[0] for x in items], [x[1] for x in items] placeholders = ["${}".format(i) for i, _ in enumerate(values, 1)] - query = "INSERT INTO {} (\"{}\") VALUES ({}) ON CONFLICT DO NOTHING RETURNING \"apiId\"".format( + query = "INSERT INTO {} (\"{}\") VALUES ({}) ON CONFLICT DO NOTHING RETURNING api_id".format( table, "\", \"".join(keys), ", ".join(placeholders)) + logging.debug(query) + logging.debug((*data)) return await conn.fetchval(query, (*data)) async def _work(self): @@ -192,7 +194,7 @@ logging.basicConfig( level=logging.DEBUG ) console = logging.StreamHandler() -console.setLevel(logging.WARNING) +console.setLevel(logging.DEBUG) logging.getLogger("").addHandler(console) loop = asyncio.get_event_loop() |
