eric-wang-1990 opened a new pull request, #2920:
URL: https://github.com/apache/arrow-adbc/pull/2920
# 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 `xxx` as 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
- Added new parameter `EscapeUnderscore` to control underscore escaping
behavior
- Added `EscapeUnderscoreInName` helper method to handle underscore escaping
- Updated all metadata query methods to use the escaping functionality:
- GetCatalogsAsync
- GetSchemasAsync
- GetTablesAsync
- GetColumnsAsync
- GetPrimaryKeysAsync
- GetCrossReferenceAsync
- GetCrossReferenceAsForeignTableAsync
## Testing
- Added test case in `CanGetColumnsExtended` to verify the escaping
functionality
- Verified that null values are handled correctly
- Verified that escaping only occurs when the flag is enabled
## Usage
To enable underscore escaping, set the parameter:
```csharp
statement.SetOption(ApacheParameters.EscapeUnderscore, "true");
```
## 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]