olirice / alembic_utils

An alembic/sqlalchemy extension for migrating sql views, functions, triggers, and policies
MIT License
193 stars 42 forks source link

Duplicated ReplaceableEntity on every migration #85

Open erakli opened 2 years ago

erakli commented 2 years ago

All ReplaceableEntities that are defined in env.py are added on every auto generated migration. Even if there are no change in those entities.

Maybe add some sort of checksum?

Anyway, thanks for a good library!

olirice commented 2 years ago

Could you please add the version of alembic utils you are using and a sample env.py I can use to reproduce the error?

erakli commented 2 years ago

Version is the latest:

alembic_utils==0.7.7

Example code - https://gist.github.com/erakli/be458b6bc8b122486001d167077a36c6

BUT

When I was creating this gist I found that I'm reading SQL functions from template files on every autogenerate so it could be the reason of duplicates.

olirice commented 2 years ago

Were you having this problem on 0.7.6? or if you don't know, could you please try installing it and check?

I don't think its it should be relevant but I released it yesterday so the timing has me worried

Thanks for the gist, I'll check it out by Monday

erakli commented 2 years ago

I had the same behavior on 0.7.6. So I tried to install 0.7.7 first but it didn't help.

olirice commented 2 years ago

PGFunction has had issues with escape characters in the past so that would be my first guess but I'd need to see the SQL files to reproduce.

If you could trim down the example to a minimum env.py file with a single in-line PGFunction that produces the behavior I'd be happy to help you debug it