At some point in the past I've run an alembic migration which creates a users
table like...
def upgrade():
...
op.create_table(
"users",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
...
sa.Column("type", sa.Enum("Foo", "Bar", "Baz", name="usertype"), nullable=False),
...
)
...
...which automatically creates the enum named usertype
with the values "Foo", "Bar", "Baz"
.
Now, I want to make some other table which also references that same enum. e.g.,
def upgrade():
...
op.create_table('foobar',
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
...
sa.Column('user_type', sa.Enum(< ???????? >), nullable=False),
...
)
What is the syntax to reference the existing enum?
I can't seem to find an answer in the docs: https://docs.sqlalchemy.org/en/13/core/type_basics.html#sqlalchemy.types.Enum