Skip to content

Allow tables without primary key #1294

Description

@slavovthinks

Primary keys are not required for Relational Table definition and are especially useless for join tables. Currently if you try to define a model without a primary key you get:

/lib/python3.10/site-packages/ormar/models/helpers/sqlalchemy.py", line 250, in populate_config_tablename_columns_and_pk
    raise ormar.ModelDefinitionError("Table has to have a primary key.")
ormar.exceptions.ModelDefinitionError: Table has to have a primary key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions