Skip to content
New issue

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

Can we prevent default values from being inserted when null=False? and give ValueError? #1055

Open
devsarvesh92 opened this issue Jul 25, 2024 · 2 comments

Comments

@devsarvesh92
Copy link

No description provided.

@dantownsend
Copy link
Member

There's a required=True arg you can specify for columns.

https://piccolo-orm.readthedocs.io/en/latest/piccolo/serialization/index.html#required-fields

This is currently just used in Pydantic models though, so you'd have use create_pydantic model to create a model, and use that for validation.

We might be able to do some validation at the Table level, but would need to think through that.

@devsarvesh92
Copy link
Author

When we use UUID(null=False, required=True, index=True) in mixins, instead of throwing an error, it assigns a default value as a random UUID. Is this acceptable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants