-
-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create_type=false
still creating enum and consequently failing on duplicate
#1347
Comments
the for current functionality the migration would look like this: op.create_table(
"batches",
sa.Column("id", sa.UUID(), nullable=False),
sa.Column(
"status",
sa.Enum(
"pending", "finished", "failed", name="assessmentstatusenum"
).with_variant(
postgresql.ENUM(
"pending",
"finished",
"failed",
name="assessmentstatusenum",
create_type=False,
),
"postgresql",
),
nullable=False,
),
) |
see sqlalchemy/sqlalchemy#10604 for SQLAlchemy 2.1 |
have you fixed this? I have the same problem with my migration
same error message, im running python3.12 and alembic 1.13.2 |
See #1347 (comment) |
use postgresql.ENUM instead of sa.Enum: sa.Column('investment_type', postgresql.ENUM('CROWD_FUNDING', 'OPEN_MARKET', 'MANAGE', name='investmenttype', create_type=False), nullable=False), |
Why this issue is closed? Isn't it possible to create enum types before tables? Why tables are created before types even if I use timestamps on files? |
Sure, but this issue was of the opposite, meaning the create type was issued when none was wanted |
surprised that the issue closed, it is still the problem with Alembic trying to create type when it is already exists and preventing from migration. I just had the same issues and had to manually update script to postgresql.ENUM and add create_type=False . Would assume that this should be handled automatically with the migration script. |
hi all - this is not an alembic issue. The issue you all want to look at is at SQLAlchemy at sqlalchemy/sqlalchemy#10604 where we will add "create_type" to the base locking this issue now |
Describe the bug
When creating a table with an already existing Enum and setting the
create_type=False
such as the belowI see the error:
Expected behavior
The Enum should be referenced on the column without attempting to create the Enum, and therefore shouldn't cause the migration to fail.
Error
Versions.
Additional context
Have a nice day!
The text was updated successfully, but these errors were encountered: