mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-25 18:23:44 +03:00
Merge branch 'anci-develop' into develop
This commit is contained in:
commit
33a8cf4be4
|
@ -106,9 +106,13 @@ class Database(object):
|
||||||
if first_instance.readonly or first_instance.system:
|
if first_instance.readonly or first_instance.system:
|
||||||
raise DatabaseException("You can't insert into read only and system tables")
|
raise DatabaseException("You can't insert into read only and system tables")
|
||||||
|
|
||||||
|
fields_list = ','.join(
|
||||||
|
['`%s`' % name for name, _ in first_instance._writable_fields])
|
||||||
|
|
||||||
def gen():
|
def gen():
|
||||||
buf = BytesIO()
|
buf = BytesIO()
|
||||||
buf.write(self._substitute('INSERT INTO $table FORMAT TabSeparated\n', model_class).encode('utf-8'))
|
query = 'INSERT INTO $table (%s) FORMAT TabSeparated\n' % fields_list
|
||||||
|
buf.write(self._substitute(query, model_class).encode('utf-8'))
|
||||||
first_instance.set_database(self)
|
first_instance.set_database(self)
|
||||||
buf.write(first_instance.to_tsv(include_readonly=False).encode('utf-8'))
|
buf.write(first_instance.to_tsv(include_readonly=False).encode('utf-8'))
|
||||||
buf.write('\n'.encode('utf-8'))
|
buf.write('\n'.encode('utf-8'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user