Skip to content

Conversation

@stevenschmatz
Copy link

Context

Previously, the check for excluded_schemas in compare_registered_entities was not working, because of this line:

observed_schemas: Set[str] = {
    schema_name
    for schema_name in all_schema_references
    if (
        schema_name
        is not None
        # OFFENDING LINE BELOW
        not in (
            registry.exclude_schemas or set()
        )  # user defined. Deprecated for remove in 0.6.0
        and schema_name not in {"information_schema", None}
    )
}

This evaluated schema_name is not None to a bool, and then checked <bool> not in (registry.exclude_schemas or set()) which is ~always false.

@olirice
Copy link
Owner

olirice commented Mar 24, 2025

you're right that this was broken but that exclude_schemas argument is deprecated and should have already been removed. I'm hesitant to change any functionality around it at this point. I think the right move would be to cut a new minor version and drop the declared deprecated parts https://olirice.github.io/alembic_utils/api/

@Tuanshu
Copy link

Tuanshu commented May 19, 2025

Thanks for this wonderful project! 🎉

I ran into the same issue and after digging through the docs, it turns out alembic’s official include_name/include_object callbacks don’t apply to the comparator API. That makes registry.exclude_schemas the only practical hook for skipping schemas in the diff.

So +1 for fixing the boolean logic (or otherwise preserving a working exclusion mechanism).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants