Skip to content

go/adbc/driver/snowflake: handling of wildcards in GetObjects #3220

@frbvianna

Description

@frbvianna

What happened?

Hi, I'm seeing unexpected results when trying to retrieve object information with adbc.GetObjects.

For instance, in the following call, the underscores and percent signs are always treated as wildcards:
cnxn.GetObjects(ctx, adbc.ObjectDepthTables, "DB%", "SCHEMA_WITH_UNDERSCORES", nil, nil, nil)

I expected to see that the identifiers would be treated literally. To my understanding, this is due to the usage of SQL LIKE. I have tried to escape these characters with \\ (two blackslashes) before calling the function, but this does not seem to work.

Besides, I have created the following schema to test the special characters:
CREATE SCHEMA <DB-NAME>." SCHEMA_MiXeD_`~!@#$%^&*()-_=+[]{};:\'""."",<>?\| 元数æ�®ç¨æˆ·å¤šå—节 ";

The schema is then displayed in Snowflake with the following name (note that the double-quotes are de-duplicated in the created object):
SCHEMA_MiXeD_`~!@#$%^&*()-_=+[]{};:\'".",<>?\| 元数æ�®ç¨æˆ·å¤šå—节

While I'm able to create this schema, I cannot retrieve its contained tables at ObjectDepthTables:
cnxn.GetObjects(ctx, adbc.ObjectDepthTables, "<DB-NAME>", " SCHEMA_MiXeD_`~!@#$%^&*()-_=+[]{};:\\'\".\",<>?\\| 元数æ�®ç¨æˆ·å¤šå—节 ", nil, nil, nil)

Can the wildcards be handled literally? Can you help to understand why I cannot retrieve the objects contained in the schema above if I provide its name?

Note that I'm intentionally testing edge cases since we expect to read arbitrary user-provided schema names in the application.

Stack Trace

No response

How can we reproduce the bug?

Create schemas with underscores _, percent signs %, or the following one, which cannot be inspected with GetObjects:
CREATE SCHEMA <DB-NAME>." SCHEMA_MiXeD_`~!@#$%^&*()-_=+[]{};:\'""."",<>?\| 元数æ�®ç¨æˆ·å¤šå—节 ";

Environment/Setup

github.com/apache/arrow-adbc/go/adbc v1.6.0
macOS 15.5

Metadata

Metadata

Assignees

Labels

Type: bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions