-
Hi! I have created a base model containing some standard fields ( The (now to be deprecated) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is no such thing as of now (btw. you cannot exclude primary keys). If you manage migrations with ormar and you need this column in the structure, then you can hack around this by also not including the fields in ormar, but adding those fields into the underlying sqlalchemy table (which is stored in Model.Meta.table), but note that this requires sqlalchemy core notation, not the orm one, so something like: column = sqlalchemy.Column(name, column_type, constraints etc.)
model.Meta.table.append_column(column) Didn't test this but just out of my mind I think it shouldn't break anything 😁 😅 |
Beta Was this translation helpful? Give feedback.
There is no such thing as of now (btw. you cannot exclude primary keys).
If you set your fields to be populated in the database (like on update current timestamp), as I believe this is your use case, you can work around this by not including the fields in the model altogether.
If you manage migrations with ormar and you need this column in the structure, then you can hack around this by also not including the fields in ormar, but adding those fields into the underlying sqlalchemy table (which is stored in Model.Meta.table), but note that this requires sqlalchemy core notation, not the orm one, so something like: