zeroshade commented on code in PR #2254:
URL: https://github.com/apache/arrow-adbc/pull/2254#discussion_r1803396703
##########
go/adbc/driver/snowflake/connection.go:
##########
@@ -85,82 +127,165 @@ func (c *connectionImpl) GetObjects(ctx context.Context,
depth adbc.ObjectDepth,
defer conn.Close()
gQueryIDs, gQueryIDsCtx := errgroup.WithContext(ctx)
+
queryFile := queryTemplateGetObjectsAll
switch depth {
case adbc.ObjectDepthCatalogs:
- if catalog == nil {
- queryFile = queryTemplateGetObjectsTerseCatalogs
- // if the catalog is null, show the terse databases
- // which doesn't require a database context
- gQueryIDs.Go(func() error {
- return conn.Raw(func(driverConn any) error {
- rows, err :=
driverConn.(driver.QueryerContext).QueryContext(gQueryIDsCtx, "SHOW TERSE
DATABASES", nil)
- if err != nil {
- return err
- }
+ queryFile = queryTemplateGetObjectsTerseCatalogs
+ gQueryIDs.Go(func() error {
+ return conn.Raw(func(driverConn any) (err error) {
+ query := "SHOW TERSE /* ADBC:getObjectsCatalogs
*/ DATABASES"
+ if catalog != nil && len(*catalog) > 0 &&
*catalog != "%" && *catalog != ".*" {
+ query += " LIKE '" +
escapeSingleQuoteForLike(*catalog) + "'"
Review Comment:
The `LIKE` keyword in the `SHOW` commands is actually *case-insensitive*
according to the docs
(https://docs.snowflake.com/en/sql-reference/sql/show-tables). But it does
treat underscores like a `LIKE` comparison, though we do say in the docs that
the arguments for "catalog" and such are treated as patterns if they include
wildcards like `_` and `%`.
--
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]