Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.

Add fold post-processing bool to SQLAlchemySchemaInfo #1015

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chewselene
Copy link
Collaborator

Adding whether or not post-processing should be applied to SQLAlchemySchemaInfo based on @obi1kenobi's comment on #1008.

Another (and perhaps even better) alternative would be to add requires_fold_postprocessing or something like it to the SQLAlchemySchemaInfo. After all, that object knows the dialect (and therefore the emitted SQL) better than anything else, so realistically it should be the one specifying whether post-processing is required or not.

I opted to default to automatic inference of whether or not fold post-processing is required based on isinstance(dialect, MSDialect), which could create a bug if SQLAlchemy adds a MSSQL dialect that does not inherit from MSDialect. This can be overruled with the keyword arg requires_fold_postprocessing in both make_sqlalchemy_schema_info and get_sqlalchemy_schema_info. I thought inferring would be more user friendly, but could make explicitly setting requires_fold_postprocessing required if there's an argument for that approach.

@LWprogramming
Copy link
Collaborator

Is it possible for there to be a case where the dialect is MSDialect but we don't want post-processing anyways? If not, it seems like we wouldn't need to have the extra parameter in the function signature and instead derive it inside the function, preventing illegal combinations of parameters from showing up.

Also, what does

if SQLAlchemy adds a MSSQL dialect that does not inherit from MSDialect

refer to? I thought we explicitly define which dialects are supported and then anything else errors out immediately anyways.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants