fix-alembic-async-engine

Convert SQLAlchemy async engines to sync engines in Alembic env.py.

Updated May 15, 2026
One-click install
npx skills add https://github.com/ruskibeats/t1d --skill fix-alembic-async-engine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: fix-alembic-async-engine
Source: https://github.com/ruskibeats/t1d/tree/main/.pi/skills-archive/fix-alembic-async-engine
Command: npx skills add https://github.com/ruskibeats/t1d --skill fix-alembic-async-engine

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses failures in Alembic migrations due to async engine configuration mismatches.

Core Features & Use Cases

  • Fixes Alembic Async Issues: Corrects 'greenlet_spawn' errors and async engine failures during migrations.
  • Engine Configuration Adjustment: Transforms async engines to sync engines, avoiding DDL sync vs. asyncpg async mismatch.
  • Use Case: When you encounter failures like greenlet_spawn has not been called during migrations, this Skill guides you to resolve it by modifying alembic/env.py.

Quick Start

Use the fix-alembic-async-engine skill to modify your Alembic configuration in 'alembic/env.py'.

Frequently Asked Questions about fix-alembic-async-engine

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does Alembic migration fail with a greenlet_spawn has not been called error?▼

The greenlet_spawn error during Alembic migration occurs due to a mismatch between SQLAlchemy's async engine setup and Alembic's sync execution requirements. Resolving it involves modifying the alembic/env.py file to reconfigure the engine setup for compatibility.

How do I fix async engine configuration issues for Alembic DDL migrations?▼

To fix async engine configuration issues for Alembic DDL migrations, modify the alembic/env.py file to transform the async engine into a sync engine. This corrects the DDL sync versus asyncpg async mismatch, allowing successful online migration execution.

What is the best way to run Alembic migrations with an asynchronous SQLAlchemy engine?▼

The best way to run Alembic migrations with an asynchronous SQLAlchemy engine is to adjust the engine configuration in alembic/env.py. This approach satisfies compatibility between SQLAlchemy's async engine setup and Alembic's synchronous DDL execution requirements.

Does Alembic support asynchronous SQLAlchemy engines for online DDL migrations?▼

Alembic requires sync execution for DDL operations, so using an asynchronous SQLAlchemy engine directly causes failures. You must adjust the alembic/env.py configuration to transform the async engine setup and satisfy the synchronous execution requirements.

Can I use asyncpg with Alembic without encountering DDL sync versus async mismatches?▼

Using asyncpg with Alembic typically causes DDL sync versus async mismatches. To avoid this, modify the alembic/env.py file to reconfigure the SQLAlchemy engine setup, transforming the async engine to allow successful online migration execution.