Alembic not creating index with BigInteger sa_column type #554
-
First Check
Commit to Help
Example Codefrom sqlalchemy import BigInteger
from sqlmodel import Field, SQLModel, Column
class Thing(SQLModel, table=True):
id: int = Field(None, primary_key=True)
not_indexed_in_alembic: int = Field(None, index=True, sa_column=Column(BigInteger()))
is_indexed_in_alembic: int = Field(None, index=True) DescriptionPlease excuse me if this is not a sqlmodel question but more to do with alembic, but figured I'd post it here first as it relates to issue #191, specifically this comment. When I am using a custom sqlalchemy type To reproduce:
Also checked this with older versions of sqlmodel and still got same issue. Operating SystemLinux Operating System DetailsUbuntu SQLModel Versionv0.8.0 Python Version3.10 Additional ContextAlembic is latest version (1.9.3) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
joining, same problem |
Beta Was this translation helpful? Give feedback.
-
When you use not_indexed_in_alembic: int = Field(
None,
# index=True, <- this will not work
sa_column=Column(BigInteger(), index=True) # <- pass column-related parameters here
) |
Beta Was this translation helpful? Give feedback.
When you use
sa_***
parameters, it hides other column-related parameters likeindex
,unique
,primary_key
, ..You need to pass these parameters to
Column
instead: