0

I would like to enforce that my migration doesn't lock a table.

In plain SQL I would use ALTER ONLINE TABLE ... or ALTER TABLE x ADD COLUMN (...), LOCK=NONE.

I can't find a way to replicate this with alembic using op.add_column.

Tewfik
  • 176
  • 2
  • 15
  • Something like [this](https://docs.sqlalchemy.org/en/20/core/compiler.html#dialect-specific-compilation-rules) with [CreateColumn](https://docs.sqlalchemy.org/en/20/core/ddl.html#sqlalchemy.schema.CreateColumn). – danblack Jul 03 '23 at 22:35

1 Answers1

0

First note ADD COLUMN cannot be LOCK=NONE for Auto-increment.

SET SESSION alter_algorithm='INSTANT';

Might be a workable alternative. Ensure you have a MariaDB-10.6.9+ version per docs.

danblack
  • 12,130
  • 2
  • 22
  • 41