Skip to content

many-many relationships not functional #228

Open

Description

@CameronNemo

Seems like an autoincrement directive is missing for the id column.

[...]/venv/lib/python3.7/site-packages/sqlalchemy/sql/crud.py:799: SAWarning: Column 'site_contact_version.id' is marked as a member of the primary key for table 'site_contact_version', but has no Python-side or server-side default generator indicated, nor does it indicate 'autoincrement=True' or 'nullable=True', and no explicit value is passed.  Primary key columns typically may not store NULL. Note that as of SQLAlchemy 1.1, 'autoincrement=True' must be indicated explicitly for composite (e.g. multicolumn) primary keys if AUTO_INCREMENT/SERIAL/IDENTITY behavior is expected for one of the columns in the primary key. CREATE TABLE statements are impacted by this change as well on most backends.
  util.warn(msg)
2019-10-01 12:37:52,592:WARNING:flask_appbuilder.models.sqla.interface:Add record integrity error: (psycopg2.errors.NotNullViolation) null value in column "id" violates not-null constraint
DETAIL:  Failing row contains (null, 1, 1, 2, null, 0).

[SQL: INSERT INTO site_contact_version (site_id, contact_id, transaction_id, operation_type) VALUES (%(site_id)s, %(contact_id)s, %(transaction_id)s, %(operation_type)s)]
[parameters: {'site_id': 1, 'contact_id': 1, 'transaction_id': 2, 'operation_type': 0}]

Activity

  1. cgearing commented on Dec 7, 2020

    @cgearing

    I'm also getting this issue - I believe the problem comes when your join tables have an auto-incrementing ID as well.

    Is that the case for you?

  2. CameronNemo commented on Dec 18, 2020

    @CameronNemo
    Author

    Was so long ago. I do not remember.

  3. KeironO commented on Jan 6, 2021

    @KeironO

    I've been experiencing similar issues, I was wondering if anyone has a solution for this?

  4. killthekitten commented on Jan 7, 2021

    @killthekitten
    Contributor

    Hey @KeironO, I could try to help you out! Could you provide some boilerplate code to reproduce the error?

  5. KeironO commented on Jan 8, 2021

    @KeironO

    @killthekitten I have meetings this morning, but will get something up this afternoon.

  6. Korrar commented on Feb 11, 2025

    @Korrar

    Anyone found some workaround or advice how to fix it?

  7. added
    pinned
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pinned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions