Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

NotNullViolationError: null value in column "id" #21

@HarrySky

Description

@HarrySky

I 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions