NotNullViolationError: null value in column "id"
See original GitHub issueI just got an exception when tried to create new database entry via await SomeModel.objects.create(...)
:
asyncpg.exceptions.NotNullViolationError: null value in column "id" violates not-null constraint
DETAIL: Failing row contains (null, John, Doe, a@b.c, 1997, M, null, f, null, f, 0, 0, null, 0, 0).
Model:
class SomeModel(Model):
__tablename__ = DATABASE_TABLE
__database__ = DATABASE
__metadata__ = DATABASE_METADATA
id = Integer(primary_key=True)
# Some other fields
According to examples it should work without providing id field manually. Maybe I am missing something?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:23 (9 by maintainers)
Top Results From Across the Web
Rails: PG::NotNullViolation: ERROR: null value in column "id ...
It seems that the id should be serial so it can auto-increment. If it is, then how to convert a id column to...
Read more >NotNullViolation: ERROR: null value in column "id" violates ...
My normal tests all went fine and gitlab was working nice. But then I tested to create a new project: PG::NotNullViolation: ERROR: null...
Read more >NotNullViolation: ERROR: null value in column "id" violates ...
I'm getting this error whenever I try to create a feature, add an actor to an existing feature, etc. Everything is still working...
Read more >PG::NotNullViolation: ERROR: null value in column "root_id ...
I added a subscription manifest and tried to add repositories. when clicking on the + icon of any repository, the operation to add...
Read more >PG::NotNullViolation error on id column in PostgreSQL
Faced with this error: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Use
TEST_DATABASE_URLS
to set one or more database URLs. We should ensure that the test runs across all configured engines in the same way as the existing test cases (so we can identify if it occurs in other cases, and confirm that any fix works correctly across all cases)You are better off using maintained async ORM like ormar. This ORM does not seem to be maintained anymore