Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [alembic]

Alembic is a lightweight database migration tool for use with the SQLAlchemy Database Toolkit for Python.

alembic
0 votes
0 answers
25 views

Alembic generates all models at revision

I am trying to run alembic on a database where there are about 20 tables that are created by sqlalchemy models. I am using 5 schemas to keep the tables separate from each other. When I run alembic ...
AnGeLL1337's user avatar
0 votes
0 answers
9 views

Fix accidental database change with Alembic

My current database differs from what alembic expects, I think because the database was changed manually. I thought I could just autogenerate a new revision that fixes the changes but get an error. Is ...
phobic's user avatar
  • 963
2 votes
2 answers
47 views

How can I stop the alembic logger from deactivating my own loggers after using an alembic command in code?

I'm using alembic in my code to apply database migrations at application start. I'm also using Python's builtin logging lib to log to the terminal. After applying the migrations (or running any ...
Tim's user avatar
  • 179
1 vote
1 answer
64 views

Alembic not recognizing multiple models, using FastAPI

i am using sqlalchemy[asyncio], sqlalchemy, fastapi, alembic, asyncmy. my database is mysql and have the following project structure: core/ ├─ database.py ├─ settings.py alemibc/ ├─ versions/ ├─ env....
coding_billi's user avatar
1 vote
0 answers
22 views

ConnectionRefusedError: [Errno 111] Connection refused. Docker, Python [duplicate]

I made a fastapi, alembic, postgres, sqlalchemy application, made a docker image, run http://127.0.0.1:8000/docs and try to create a user, but when sending a request I get the error ...
123 123's user avatar
  • 11
0 votes
0 answers
19 views

Can I manage multiple bases in alembic across git repos?

We currently have a monolithic database that we manage with SQLAlchemy and alembic on which we have a number of applications that read and write, each located in a separate git repo. At present, our ...
Sty's user avatar
  • 800
0 votes
1 answer
47 views

Docker cant create my tables with Alembic (or maybe its something with SQLAlchemy)

When I try to run my program not in Docker, everything is OK, but when I try to docker-compose up --build with Docker, I get the error sqlalchemy.exc.MissingGreenlet: greenlet_spawn has not been ...
Vog Prostit's user avatar
0 votes
1 answer
43 views

Alembic configuration using Environment variables

I've been having trouble with database configuration using Alembic considering I am using environment variables and my password has a special character. Is there an easier way to do it other than ...
Ivy Kutswa's user avatar
1 vote
1 answer
56 views

Alembic creates foreign key constraints before other table is created

I'm trying to setup Alembic for the first time. I dropped all my tables, so that Alembic would be starting from scratch. I entered alembic revision --autogenerate -m "Initial tables" ...
Peter Kronenberg's user avatar
0 votes
0 answers
33 views

Issue with Enums and inputting

I have an issue with invalid enum input when trying to update my database model. The error is below. I am not sure what I am doing wrong sqlalchemy.exc.DataError: (psycopg2.errors....
Sammy Lam's user avatar
0 votes
0 answers
66 views

How to add automated created_at and updated_at columns using alembic?

Like in rails when we create a migration, rails itself add a 2 columns created_at and updated_at and it is automatically updated in the database. How to do this in python using alembic? Like to ...
Manu shalta's user avatar
1 vote
1 answer
33 views

Why is alembic setting all of my fields as nullable=False?

Here is my model: class Base(DeclarativeBase): pass class AppUser(Base): __tablename__ = "app_user" id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True) ...
wsaxton's user avatar
  • 1,080
1 vote
1 answer
63 views

sqlalchemy 'relation does not exist' after flask migrate

I have a sqlalchemy flask app that I am migrating from sqlalchemy 1.3 to 2.0. I have added Mapped typing to all of the tables and am now running into a problem with the alembic/flask-migrate ...
simpleCoder's user avatar
0 votes
1 answer
137 views

Alembic doesn't see SQLModel models and creates empty migrations

I'm using SQLModel with Alembic for database migrations in my project. However, Alembic doesn't seem to recognize my models and creates empty migrations. Here's the code for my model: from sqlmodel ...
DARK's user avatar
  • 1
0 votes
0 answers
26 views

Flask SQL, alembic and SQlite: how to avoid delete object when is referenced (Foreign Key) [duplicate]

Given 2 tables: transactions and categories. Transactions contains a FK category_id with the ID of assigned category. I want to not allow delete categories referenced by transactions. I mean: if there ...
UrbanoJVR's user avatar
  • 1,228

15 30 50 per page
1
2 3 4 5
61