-
-
Notifications
You must be signed in to change notification settings - Fork 11
Support sequence of metadata objects in target_metadata #91
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
Comments
Interesting! so i assume we're talking about this: https://github.com/DanCardin/sqlalchemy-declarative-extensions/blob/main/src/sqlalchemy_declarative_extensions/alembic/schema.py#L23 as the exception point. The main problem I see is that of combining multiple instances of each object together. I suppose I need some The only remaining problem is that Views actually make use of the metadata downstream, in order to provide a naming-scheme in the case of materialized view indices. I think.....similarly this could be made to assert they're the same before passing it through, because again once you're at the point of comparing existing index names vs declared ones, the literal metadata instance would be ambiguous. tl;dr should be doable |
I suppose it might be worth submitting a bug to alembic, their type annotation implies it's |
just kidding, i just submitted a PR to update the typing |
mmm Rows also uses metadata in a way that's probably the least easy to work around. I could probably release the fix much more quickly for |
Actually the ones I'd be interested in would be grants and ideally roles |
ah good. both are on the straightforward side relative to View/Row |
I suppose I'll reopen this though because of Views/Rows |
Since alembic rev 0.9.0, we can pass a sequence of objects in target_metadata.
When trying to declare my database (
declare_database(Base.metadata, schemas=Schemas().are(Base.metadata.schema))
) using sqlalchemy-declarative-extensions and autogenerating a migration, I will get anAttibuteError: 'list' object has no attribute 'info'
in all the comparators that will try to fetch the infodeclare_database
has stored against the metadata.I believe one way to fix this would be to, like they did in their tests setup, coerce target_metadata into a list before interating through all metadata objects.
The text was updated successfully, but these errors were encountered: