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
0 answers

Getting a Connection failed error when deploying an API

In the development environment I am not getting any errors but when deploying the same API on UBUNTU OR HEROKU I am getting an connection failed error Where's my database file where I am connecting to the database using sqlalchemy from sqlalchemy…
0
votes
1 answer

TypeError: option values must be strings when setting database url (Alembic)

In this FastAPI projet I'm trying to load an environment variable called DATABASE_URL inside Alembic env.py file and use it as follows: env.py from alembic import context import os from dotenv import load_dotenv config =…
William Le
  • 825
  • 1
  • 9
  • 16
0
votes
1 answer

SQLAlchemy Alembic Migration generate SQL scripts at revision step with --autogenerate

We use SQLAlchemy + Alembic to generate migrations as python code (default behaviour for Alembic). We want to move from python to SQL scripts as it provides more control over the generated scripts. It seems the command revision --autogenerate…
deepdive
  • 9,720
  • 3
  • 30
  • 38
0
votes
1 answer

alembic autogenerate revision try to drop all the index and tables of my database

I'm working on an existant FastAPI application which uses a GCP SQL database. I made minor changes locally on the database schema and I created a local postgresql database to test my changes. I autogenerated migration with alembic , But it generates…
0
votes
0 answers

"Bad value substitution" error in Alembic

Can't make migrations to albemic I try to write this command in cmd but i getting Error alembic revision --autogenerate -m "User table" Error configparser.InterpolationMissingOptionError: Bad value substitution: option 'sqlalchemy.url' in section…
0
votes
0 answers

ModuleNotFoundError: alembic - sqlalchemy

I am trying to set up alembic to check my db, but I am getting this error when I try to run the command mentioned below. Folder architecture: Part of the configuration (env.py) The error is on import from logging.config import fileConfig from…
Bruno Lorena
  • 73
  • 1
  • 9
0
votes
1 answer

alembic can not find python-dateutil

I am trying to create a simple migration using alembic revision -m "ddl for some migration" and I am getting the following error: FAILED: The library 'python-dateutil' is required for timezone support I have already tried reinstalling python 3.8…
saadi
  • 646
  • 6
  • 29
0
votes
0 answers

How to disable automatic modifiaction of the database schema in sqalchemy?

When sqalchemy application starts, it automatically modifies database schema, so that database tables would reflect ORM models in python code. In my case it's very unwanted, because when I'm switching between different branches / writing new…
0
votes
1 answer

Can not run migrations with alembic. Socket error

Here i created a User model using sqlmodel. from sqlmodel import SQLModel, Field, Index from typing import Optional class User(SQLModel, table=True): id: Optional[int] = Field(default=None, primary_key=True) name: str =…
haku
  • 35
  • 5
0
votes
1 answer

Alembic & Postgres: how to switch to another schema

I have a postgres database with default public schema, which hosts some tables, including alembic migrations table. I want a postgres database with an app schema, with all the tables (including alembic migrations) moved there. How can I do this…
psarka
  • 1,562
  • 1
  • 13
  • 25
0
votes
1 answer

Python in Maya, syntax error for UV script

I'm trying to assign root UVs to an alembic Maya XGen file, so that I can give the XGen fur the colours of the mesh underneath in Unreal Engine. I have a jaguar mesh with UVs assigned, and am trying to transfer them to the alembic groom. I'm using…
0
votes
1 answer

how to export a alembic file via script in Unity

Is there any way that we can export a alembic file via script, the purpose that I want is store my own data(normals, uv, color ...) to alembic file instead of alembic itself to compute?
worker
  • 1
  • 2
0
votes
1 answer

Flask Migrate - IndexError on migration

I'm using Flask Migrate with SQLite3. I have the following upgrade script: from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'e0b1170b3c02' down_revision = '9fac07025424' branch_labels =…
Henry
  • 3,472
  • 2
  • 12
  • 36
0
votes
1 answer

SQLAlchemy not recognising value

I have a bot which uses sqlalchemy to interface with the database. The bot is created using Flask and Twilio and it is connected to an AzureSQL database. When saving a response, I use the code: db.save(dbTable(content=incoming_msg, …
Ben
  • 41
  • 5
0
votes
1 answer

How to VACUUM a SQLite database from within an Alembic migration?

I am using SqlAlchemy Alembic to perform DB migrations on a SQLite database. One of my migrations removes many redundant records and I would like to VACUUM the database after the deletion. Here's how I'm trying to do this in my migration's…
urig
  • 16,016
  • 26
  • 115
  • 184