fix: support case-sensitive Fabric Warehouse collations#375
Open
sdebruyn wants to merge 1 commit into
Open
Conversation
dbt-adapters' default `_make_match_kwargs` lowercases identifiers when `quoting.case_sensitive` is False (the dbt-core default). On a Fabric Warehouse provisioned with a case-sensitive collation (e.g. SQL_Latin1_General_CP1_CS_AS), dbt then looks up the lowercased name and Fabric correctly returns no such object, making the adapter unusable against the warehouse. Override `_make_match_kwargs` on FabricAdapter to match identifiers exactly as written, and unskip TestCachingUppercaseModel which now passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #373.
FabricAdapterdoes not override_make_match_kwargs, so dbt-adapters' default runs unchanged and lowercases identifiers wheneverquoting.case_sensitiveisFalse(the dbt-core default). On a Fabric Warehouse provisioned with a case-sensitive collation (e.g.SQL_Latin1_General_CP1_CS_AS), dbt then asks Fabric for a relation by its lowercased name and Fabric correctly answers "no such object" — making the adapter unusable on that warehouse.How
Add a one-method override on
FabricAdapterthat usesfilter_null_valuesto dropNones but preserves the original casing ofdatabase,schema, andidentifier:Behaviour on case-insensitive collations is unchanged: Fabric's identifier comparison ignores case on those collations regardless of what we pass in.
Test plan
TestCachingUppercaseModel(was markedpytest.mark.skip(reason="Fabric DW does not support Case Insensivity.")). It exercises the relation-cache hit path with mixed-case identifiers; with the override in place it now passes against case-sensitive collations and continues to pass against case-insensitive ones.Closes #373