We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I supposed that the following code should get create table SQL into the s2 variable, but it raises the exception instead.
create table
s2
In [1]: from infi import clickhouse_orm as orm In [2]: from utils.chdb import chdb In [3]: db = chdb() In [4]: class TestModel(orm.Model): ...: source = orm.StringField() ...: created_at_date = orm.DateField(default=orm.F.today()) ...: engine = orm.MergeTree(partition_key=('created_at_date',),order_by=('source',)) ...: In [5]: db.create_table(TestModel) In [6]: s1 = TestModel.create_table_sql(db) In [7]: TestModelAdHoc = db.get_model_for_table(TestModel.table_name()) In [8]: s2 = TestModelAdHoc.create_table_sql(db) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[8], line 1 ----> 1 s2 = TestModelAdHoc.create_table_sql(db) File ~/py.3.11.transitflow/lib/python3.11/site-packages/infi/clickhouse_orm/models.py:369, in Model.create_table_sql(cls, db) 367 # Engine 368 parts.append(')') --> 369 parts.append('ENGINE = ' + cls.engine.create_table_sql(db)) 370 return '\n'.join(parts) AttributeError: 'NoneType' object has no attribute 'create_table_sql'
A reason probably that the get_model_for_table() method doesn't analize and store the table engine definition in the returned AdHoc model.
get_model_for_table()
AdHoc
[remark for the sample code: the chdb() call returns the current Database instance]
chdb()
Database
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I supposed that the following code should get
create table
SQL into thes2
variable, but it raises the exception instead.A reason probably that the
get_model_for_table()
method doesn't analize and store the table engine definition in the returnedAdHoc
model.[remark for the sample code: the
chdb()
call returns the currentDatabase
instance]The text was updated successfully, but these errors were encountered: