forked from LBRYCommunity/lbry-sdk
better debug badrow
This commit is contained in:
parent
4d1eafc0a4
commit
564018c937
1 changed files with 9 additions and 7 deletions
|
@ -570,19 +570,21 @@ class BulkLoader:
|
||||||
for chunk_rows in chunk(rows, batch_size):
|
for chunk_rows in chunk(rows, batch_size):
|
||||||
try:
|
try:
|
||||||
execute(sql, chunk_rows)
|
execute(sql, chunk_rows)
|
||||||
except:
|
except Exception:
|
||||||
for row in chunk_rows:
|
for row in chunk_rows:
|
||||||
try:
|
try:
|
||||||
execute(sql, [row])
|
execute(sql, [row])
|
||||||
except:
|
except Exception:
|
||||||
print(sql)
|
|
||||||
print(row)
|
|
||||||
with open('badrow', 'wb') as badrow:
|
|
||||||
badrow.write(str(sql).encode())
|
|
||||||
badrow.write(repr(row).encode())
|
|
||||||
p.ctx.message_queue.put_nowait(
|
p.ctx.message_queue.put_nowait(
|
||||||
(Event.COMPLETE.value, os.getpid(), 1, 1)
|
(Event.COMPLETE.value, os.getpid(), 1, 1)
|
||||||
)
|
)
|
||||||
|
with open('badrow', 'a') as badrow:
|
||||||
|
badrow.write(repr(sql))
|
||||||
|
badrow.write('\n')
|
||||||
|
badrow.write(repr(row))
|
||||||
|
badrow.write('\n')
|
||||||
|
print(sql)
|
||||||
|
print(row)
|
||||||
raise
|
raise
|
||||||
if p:
|
if p:
|
||||||
done += int(len(chunk_rows)/row_scale)
|
done += int(len(chunk_rows)/row_scale)
|
||||||
|
|
Loading…
Reference in a new issue