You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is already possible but I think it would be useful to be able pre_statements/post_statements during the table creation phase in python.
My use case is that I want to setup and index for a postgres table but only do that after the underlying snapshot table was created.
I don't want to do this every time during model evaluation.
I could achieve the desired behavior in SQL models by defining a macro in python like this and using it in the model.
I looked around the code and found that you can set pre_statements in @model decorator, but those give me an error in python models too: Error: Invalid extra fields {'post_statements'} in the model definition at '/home/python/sqlmesh/models/pymodel.py'
I wonder though if its also possible to do this in a python model?
Ideally I would like to execute pre/post statements like this, reusing the macros too:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am not sure if this is already possible but I think it would be useful to be able pre_statements/post_statements during the table creation phase in python.
My use case is that I want to setup and index for a postgres table but only do that after the underlying snapshot table was created.
I don't want to do this every time during model evaluation.
I could achieve the desired behavior in SQL models by defining a macro in python like this and using it in the model.
The documentation says that you can use fetchdf but I think that is only done during the evaluation phase?
I looked around the code and found that you can set pre_statements in
@model
decorator, but those give me an error in python models too:Error: Invalid extra fields {'post_statements'} in the model definition at '/home/python/sqlmesh/models/pymodel.py'
I wonder though if its also possible to do this in a python model?
Ideally I would like to execute pre/post statements like this, reusing the macros too:
Beta Was this translation helpful? Give feedback.
All reactions