Skip to content

Commit

Permalink
Use msgpack.Unpacker.feed() method
Browse files Browse the repository at this point in the history
  • Loading branch information
chezou committed Aug 19, 2024
1 parent e8d1b95 commit a218334
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tdclient/job_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,11 @@ def job_result_format_each(self, job_id, format, header=False):
if code != 200:
self.raise_error("Get job result failed", res, "")
if format == "msgpack":
unpacker = msgpack.Unpacker(res, raw=False)
for row in unpacker:
yield row
unpacker = msgpack.Unpacker(raw=False)
for buf in res.stream(1024**3):
unpacker.feed(buf)
for row in unpacker:
yield row
elif format == "json":
for row in codecs.getreader("utf-8")(res):
yield json.loads(row)
Expand Down

0 comments on commit a218334

Please sign in to comment.