feat(csharp/src/Drivers/Apache): Add escape underscore parameter to metadata command #2920
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.
Add support for escaping underscores in metadata queries
Why
For current Power BI ODBC connection we are escaping all the underscore. I've thinking about change in the connector side to always pass in the escaped name, but it is not feasible since later we will introduce sql text based metadata query like DESCRIBE TABLE
xxxas json, where we would expect xxx not be escaped since it will be treated as text.Thus the best way is to introduce a new parameter in the metadata api to specify whether the client want to escape the underscore, then on the driver side based on different calling method(Thrift API or sql text) we can perform differently.
Description
This PR adds support for escaping underscores in metadata query parameters through a new parameter
adbc.get_metadata.escape_underscore. When enabled, underscores in catalog, schema, table, and column names will be treated as literal characters rather than SQL wildcards.Changes
EscapeUnderscoreto control underscore escaping behaviorEscapeUnderscoreInNamehelper method to handle underscore escapingTesting
CanGetColumnsExtendedto verify the escaping functionalityUsage
To enable underscore escaping, set the parameter:
Impact
This change allows users to query metadata for objects that contain underscores in their names without the underscore being interpreted as a SQL wildcard character.