mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2025-07-24 06:49:56 +03:00
Fixed "TypeError: a bytes-like object is required, not 'str'" on \n insertions
This commit is contained in:
parent
76718426bf
commit
533e6e187a
|
@ -55,7 +55,7 @@ class Database(object):
|
|||
try:
|
||||
first_instance = next(i)
|
||||
except StopIteration:
|
||||
return # model_instances is empty
|
||||
return # model_instances is empty
|
||||
model_class = first_instance.__class__
|
||||
|
||||
if first_instance.readonly:
|
||||
|
@ -66,13 +66,13 @@ class Database(object):
|
|||
buf.write(self._substitute('INSERT INTO $table FORMAT TabSeparated\n', model_class).encode('utf-8'))
|
||||
first_instance.set_database(self)
|
||||
buf.write(first_instance.to_tsv(include_readonly=False).encode('utf-8'))
|
||||
buf.write('\n')
|
||||
buf.write('\n'.encode('utf-8'))
|
||||
# Collect lines in batches of batch_size
|
||||
lines = 2
|
||||
for instance in i:
|
||||
instance.set_database(self)
|
||||
buf.write(instance.to_tsv(include_readonly=False).encode('utf-8'))
|
||||
buf.write('\n')
|
||||
buf.write('\n'.encode('utf-8'))
|
||||
lines += 1
|
||||
if lines >= batch_size:
|
||||
# Return the current batch of lines
|
||||
|
|
Loading…
Reference in New Issue
Block a user