Skip to content

Alembic generate unnecessary alter commands to column for Identity #1181

Discussion options

You must be logged in to vote

Hi,

i assume it is because my ORM model column does not have Identity defined in Column()?

that's correct. use Identity in the orm model columns or setup an appropriate filter to atogenerate https://alembic.sqlalchemy.org/en/latest/autogenerate.html#controlling-what-to-be-autogenerated

My expectation was nothing should be generated a simple empty upgrade / downgrade method shall be generated but this generates above mentioned methods in revision file.

alembic has no way of knowing that you are modifying the create table sql to add identity. All it sees is that the table in the metadata has no identity, while the db has it, so it renders the removal of it.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@indiVar0508
Comment options

@indiVar0508
Comment options

@CaselIT
Comment options

@indiVar0508
Comment options

@sl-tarvin
Comment options

Answer selected by indiVar0508
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants