Skip to content

vNext Migration

Ormdantic vNext is a breaking Rust-backed release.

Major Changes

  • Pydantic v2 is required.
  • SQLAlchemy and PyPika are no longer runtime dependencies.
  • Database execution is handled by the Rust extension.
  • Table DDL is generated by Rust.
  • database._engine and database._metadata are removed from supported usage.

Setup Changes

Old:

async with database._engine.begin() as conn:
    await database.init()
    await conn.run_sync(database._metadata.drop_all)
    await conn.run_sync(database._metadata.create_all)

New:

await database.init()
await database.drop_all()
await database.create_all()

Pydantic Changes

Use Pydantic v2 APIs:

  • .model_dump() instead of .dict()
  • .model_dump_json() instead of .json()
  • .model_rebuild() instead of .update_forward_refs()

Transactions

async with database.transaction():
    await database[Flavor].insert(Flavor(id="1", name="mocha"))