rethinkdb-python icon indicating copy to clipboard operation
rethinkdb-python copied to clipboard

'JsonSourceFile' object has no attribute 'bytes_processed' when using restore

Open brimimc opened this issue 3 years ago • 1 comments

Describe the bug When running a rethinkdb restore and a single document exceeds the max document size, instead of seeing the expected error message you see 'JsonSourceFile' object has no attribute 'bytes_processed'

To Reproduce Steps to reproduce the behavior:

  1. do a rethinkdb restore that included a document larger than the default max size of 134217728 bytes

Expected behavior you should see the error message Error: JSON max buffer size exceeded on file %s (from position %d). Use '--max-document-size' to extend your buffer."

Screenshots If applicable, add screenshots to help explain your problem.

System info

  • OS: [e.g. macOS Mojave 10.14.3]
  • RethinkDB Version: 2.4.1

Additional context It seems that the bug is that on this line https://github.com/rethinkdb/rethinkdb-python/blob/master/rethinkdb/_import.py#L513 I don't see bytes_processed defined anywhere - not sure if it should be _bytes_read instead

brimimc avatar Aug 07 '22 04:08 brimimc

Thanks for noticing it!

We're currently working on a new version of the driver that will drop support for python 2, allowing us to refactor part of the code and improve the functionality. The bug should be fixed with your suggestion, though at the moment I don't have the means to test it.

I'll keep the issue open and fill a PR for solving this. Once the testing environment is done we'll test it thoughtfully.

lsabi avatar Aug 09 '22 20:08 lsabi