Questions tagged [alembic]

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

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

Some of the important operations that can be performed with alembic are

  • Upgrade(Perform Database migrations, Example: create/alter/modify)
  • Downgrade(Its the reverse operation of upgrade to undo the upgrade changes)
  • Current(Show the current revision and state of migration in the database)
  • Init(Initialize a new scripts directory)
  • Revision(Create a new revision file)

Related tags

References

854 questions
0
votes
1 answer

alembic not generating tables in schema

I have a docker setup consisting of three containers. A) uvicorn/fastAPI app B) mongoDB C) Postgres DB All three working. This is a problem with alembic, hosted in container A with the rest of my app, making changes to postgres in container C. I…
SydDevious
  • 103
  • 1
  • 10
0
votes
1 answer

Alembic ignores new model and does not add new table to revision

How can I make alembic take a new file with a new model into account for a new revision? All the models are in the same directory /models but alembic seems to ignore it. How can it be included and tracked by alembic?
KZiovas
  • 3,491
  • 3
  • 26
  • 47
0
votes
1 answer

How to connect Google cloud SQL with alembic

I am new to Google cloud. My application is build with python FastAPI with alembic migrations. I am looking for the best way to connect to Google cloud SQL with alembic to run my migrations. Thanks. Please share sample code. Trying to connect using…
0
votes
1 answer

Multiple schema with different tables

I’m using alembic + sqlalchemy to manage a Postgres database. At the moment I have one single schema with a lot of table inside. I would like to organize tables based on their functions (table generated from csv importing, transformation tables,…
0
votes
1 answer

Problem with updating an ENUM type in postgresql and alembic

I have an issue with ENUM in postgresql and alembic and I couldn't resolve the problem using the existing topics in the StackOverflow in this regard. I had the following code: from sqlalchemy.dialects.postgresql import ENUM from enum import…
0
votes
1 answer

Alembic creates table in default "postgres" data base instead of the existing database

I have a fast api app used to handle data base migrations with alembic and sql alchemy as per this example: https://github.com/nf1s/fastapi_sqlalchemy_alembic/blob/master/alembic/env.py The .env file in my alembic directory looks like this : from…
Boris
  • 716
  • 1
  • 4
  • 25
0
votes
1 answer

Upgrading Airflow Deployment via Helm

I am running a helm upgrade --install on an airflow deployment the current deployment is on version 2.6 and the new version is also on 2.6 and the base image is the same the difference is new details being added to values.yml file however I keep…
0
votes
0 answers

SQLAlchemy and Alembic cascade delete

I'm using FastAPI with SQLAlchemy, Alembic, and SQLite3. Here are my simplified models class Parent(Base): __tablename__ = "parent" id = Column(Integer, primary_key=True, index=True) children = relationship( "Child",…
0
votes
0 answers

SQLalchemy migrate makes changes to previous version file

Why am I getting this error? File "/Users/user1/Development/projects/zen/zen_api/zen_api/migrations/versions/ab4404d743ac_.py", line 24, in upgrade sa.Column("expires_at", sa.NullType(), nullable=False), …
Liondancer
  • 15,721
  • 51
  • 149
  • 255
0
votes
0 answers

Alembic: how to use 2 revision folders for 1 database?

I've 2 applications sharing 1 database. It shouldn't be a problem if both applications only alter the schema of their own tables, but what if both applications want to modify the same table? Is that even possible with Alembic?
Mr. B.
  • 8,041
  • 14
  • 67
  • 117
0
votes
0 answers

Error: Alembic adds a leading space to a column name when running auto migration

I am using Flask and SQLAlchemy. I have a model defined like this class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String(255)) rank = Column(Integer, nullable=False) score =…
pnna
  • 113
  • 1
  • 6
0
votes
0 answers

Create an alembic upgrade process from configuration taken by another package

I'm extending a 3rd party application which internally uses SQLAlchemy and Alembic. This is good, because I need to extend the database model of this application but I don't want to fork the project. So, I'm trying to use alembic in my extension…
keul
  • 7,673
  • 20
  • 45
0
votes
0 answers

How to connect alembic to sqlalchemy.orm.DeclarativeBase models?

I am new to FastAPI. I am currently studying FastAPI Users https://fastapi-users.github.io/fastapi-users/10.4/configuration/databases/sqlalchemy/ My question is: How can I migrate the "User" model using alembic, given that I already have models of…
0
votes
1 answer

How to change the name of the column that is based on a Model in FastAPI?

In FastAPI the database is generated automatically and it was created based on the models I had in the moment. After the database creation I changed a model's property name from "owner_id" to "user_id" but after re-runing the API it does not…
0
votes
0 answers

Flask-Migrate Alembic tries to recreate table each run

I am facing an issue with Alembic and Flask-Migrate tools. I have the following codes: manager.py import os from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from models import * from app import app,…
Aniss Chohra
  • 391
  • 4
  • 18