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

when i adding the background table this happened. #1295

Open
1 task done
FARMAN9 opened this issue Aug 10, 2024 · 2 comments
Open
1 task done

when i adding the background table this happened. #1295

FARMAN9 opened this issue Aug 10, 2024 · 2 comments

Comments

@FARMAN9
Copy link

FARMAN9 commented Aug 10, 2024

Privileged issue

  • I'm @tiangolo or he asked me directly to create an issue here.

Issue Content

sqlalchemy.exc.IntegrityError: (psycopg.errors.NotNullViolation) null value in column "id" violates not-null constraint
backend-1 | DETAIL: Failing row contains ([email protected], t, t, null, $2b$12$O1FGCpDKGwyy6wH6CEA0lOpBAxETlYbAg.ib9av622HcJ/YB1AY1C, null).
backend-1 | [SQL: INSERT INTO "user" (email, is_active, is_superuser, full_name, hashed_password) VALUES (%(email)s::VARCHAR, %(is_active)s, %(is_superuser)s, %(full_name)s::VARCHAR, %(hashed_password)s::VARCHAR) RETURNING "user".id]
backend-1 | [parameters: {'email': '[email protected]', 'is_active': True, 'is_superuser': True, 'full_name': None, 'hashed_password': '$2b$12$O1FGCpDKGwyy6wH6CEA0lOpBAxETlYbAg.ib9av622HcJ/YB1AY1C'}]
backend-1 | (Background on this error at: https://sqlalche.me/e/20/gkpj)

@bereydev
Copy link

Base on your provided information it seems like you are facing a migration issue. If you added a new table did you make sure to run a migration on your database ?

Also could you please add some steps to reproduce. A generic SQL log trace seems a bit light to work with.

Thanks!

@vedantulhe12
Copy link

The problem appears to be that the user table's id column isn't receiving a value during the INSERT, according to the information you provided. This occurs as a result of the column not being configured to automatically generate values (for example, by using autoincrement=True or a UUID). Make sure the ID is set up to generate itself by double-checking your model and database schema. Make sure this configuration is reflected in your migrations as well. I hope this will work.

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

3 participants