mirror of
https://github.com/Infinidat/infi.clickhouse_orm.git
synced 2024-11-26 02:33:45 +03:00
Fix for create_table_sql for Buffer table
This commit is contained in:
parent
c9697de56c
commit
d19787cb9f
|
@ -80,11 +80,11 @@ class Buffer(Engine):
|
||||||
self.max_bytes = max_bytes
|
self.max_bytes = max_bytes
|
||||||
|
|
||||||
|
|
||||||
def create_table_sql(self, db_name, target):
|
def create_table_sql(self, db_name, main_model):
|
||||||
# Overriden create_table_sql example:
|
# Overriden create_table_sql example:
|
||||||
#sql = 'ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000)'
|
#sql = 'ENGINE = Buffer(merge, hits, 16, 10, 100, 10000, 1000000, 10000000, 100000000)'
|
||||||
sql = 'ENGINE = Buffer(%s, %s, %d, %d, %d, %d, %d, %d, %d)' % (
|
sql = 'ENGINE = Buffer(%s, %s, %d, %d, %d, %d, %d, %d, %d)' % (
|
||||||
db_name, target.table_name(), self.num_layers,
|
db_name, main_model.table_name(), self.num_layers,
|
||||||
self.min_time, self.max_time, self.min_rows,
|
self.min_time, self.max_time, self.min_rows,
|
||||||
self.max_rows, self.min_bytes, self.max_bytes
|
self.max_rows, self.min_bytes, self.max_bytes
|
||||||
)
|
)
|
||||||
|
|
|
@ -168,6 +168,6 @@ class BufferModel(Model):
|
||||||
Returns the SQL command for creating a table for this model.
|
Returns the SQL command for creating a table for this model.
|
||||||
'''
|
'''
|
||||||
parts = ['CREATE TABLE IF NOT EXISTS `%s`.`%s` AS `%s`.`%s`' % (db_name, cls.table_name(), db_name, cls.main_model.table_name())]
|
parts = ['CREATE TABLE IF NOT EXISTS `%s`.`%s` AS `%s`.`%s`' % (db_name, cls.table_name(), db_name, cls.main_model.table_name())]
|
||||||
engine_str = cls.engine.create_table_sql(db_name, cls)
|
engine_str = cls.engine.create_table_sql(db_name, cls.main_model)
|
||||||
parts.append(engine_str)
|
parts.append(engine_str)
|
||||||
return ' '.join(parts)
|
return ' '.join(parts)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user