Skip to content

Conversation

@birschick-bq
Copy link
Contributor

@birschick-bq birschick-bq commented Apr 1, 2025

This feature adds support for making native metadata queries to data source.

The caller sets statement options to determine the metadata command and parameters.

Statement Options

Option Description Default
adbc.apache.statement.is_metadata_command Indicate that the value of AdbcStatement.SqlQuery contains the name of a native metadata command. If set to True, it indicates a metadata command query whereas a value of False indicates a SQL command query.

Supported metadata commands include: GetPrimaryKeys, GetCrossReference, GetCatalogs, GetSchemas, GetTables, and GetColumns.
False
adbc.apache.catalog_name The catalog name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetPrimaryKeys, GetCrossReference, GetSchemas, GetTables, and GetColumns.
adbc.apache.schema_name The schema name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetPrimaryKeys, GetCrossReference, GetSchemas, GetTables, and GetColumns.
adbc.apache.table_name The table name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetPrimaryKeys, GetCrossReference, GetSchemas, GetTables, and GetColumns.
adbc.apache.table_types The comma-separated list of table types when used with a metadata command query.

Supported metadata commands include: GetTables.
adbc.apache.column_name The column name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetColumns.
adbc.apache.foreign_catalog_name The foreign (i.e., child) catalog name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetCrossReference.
adbc.apache.foreign_schema_name The foreign (i.e., child) schema name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetCrossReference.
adbc.apache.foreign_table_name The foreign (i.e., child) table name (or pattern) when used with a metadata command query.

Supported metadata commands include: GetCrossReference.

@birschick-bq birschick-bq marked this pull request as ready for review April 2, 2025 03:37
@github-actions github-actions bot added this to the ADBC Libraries 18 milestone Apr 2, 2025
@birschick-bq
Copy link
Contributor Author

@davidhcoe / @CurtHagenlocher - Open to suggestions about option/parameter naming.

Copy link
Contributor

@CurtHagenlocher CurtHagenlocher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround on this! I left a few suggestions, and some merge conflicts will need to be resolved manually.

public const string ColumnName = "adbc.apache.column_name";
public const string ForeignCatalogName = "adbc.apache.foreign_catalog_name";
public const string ForeignSchemaName = "adbc.apache.foreign_schema_name";
public const string ForeignTableName = "adbc.apache.foreign_table_name";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish I had insisted more strongly on a different set of names in the beginning because now we're never going to change them :(. I find it's "just weird" to call these things "adbc.apache" as if the entire project wasn't an Apache project already. They should have been named something like "adbc.hiveserver2".

Anyway, I think we should take a cue from the existing option names for ingestion e.g. adbc.ingest.target_catalog and name these after their semantic purpose, so maybe something like adbc.get_metadata.target_catalog, adbc.get_metadata.target_db_schema, etc. trying to aim for maximum consistency with metadata identifier names that already exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CurtHagenlocher
Using the pattern adbc.get_metadata.*. Let me know if these names make sense.

@birschick-bq birschick-bq marked this pull request as draft April 3, 2025 16:15
@birschick-bq birschick-bq marked this pull request as ready for review April 3, 2025 17:14
Copy link
Contributor

@CurtHagenlocher CurtHagenlocher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

@CurtHagenlocher CurtHagenlocher merged commit aa1053a into apache:main Apr 3, 2025
8 checks passed
colin-rogers-dbt pushed a commit to dbt-labs/arrow-adbc that referenced this pull request Jun 10, 2025
…ies using statement options (apache#2665)

This feature adds support for making native metadata queries to data
source.

The caller sets statement options to determine the metadata command and
parameters.

### Statement Options

| Option | Description | Default |
| :--- | :--- | :--- |
| `adbc.apache.statement.is_metadata_command` | Indicate that the value
of `AdbcStatement.SqlQuery` contains the name of a native metadata
command. If set to `True`, it indicates a metadata command query whereas
a value of `False` indicates a SQL command query. <br><br>Supported
metadata commands include: `GetPrimaryKeys`, `GetCrossReference`,
`GetCatalogs`, `GetSchemas`, `GetTables`, and `GetColumns`. | `False` |
| `adbc.apache.catalog_name` | The catalog name (or pattern) when used
with a metadata command query. <br><br>Supported metadata commands
include: `GetPrimaryKeys`, `GetCrossReference`, `GetSchemas`,
`GetTables`, and `GetColumns`. | |
| `adbc.apache.schema_name` | The schema name (or pattern) when used
with a metadata command query. <br><br>Supported metadata commands
include: `GetPrimaryKeys`, `GetCrossReference`, `GetSchemas`,
`GetTables`, and `GetColumns`. | |
| `adbc.apache.table_name` | The table name (or pattern) when used with
a metadata command query. <br><br>Supported metadata commands include:
`GetPrimaryKeys`, `GetCrossReference`, `GetSchemas`, `GetTables`, and
`GetColumns`. | |
| `adbc.apache.table_types` | The comma-separated list of table types
when used with a metadata command query. <br><br>Supported metadata
commands include: `GetTables`. | |
| `adbc.apache.column_name` | The column name (or pattern) when used
with a metadata command query. <br><br>Supported metadata commands
include: `GetColumns`. | |
| `adbc.apache.foreign_catalog_name` | The foreign (i.e., child) catalog
name (or pattern) when used with a metadata command query.
<br><br>Supported metadata commands include: `GetCrossReference`. | |
| `adbc.apache.foreign_schema_name` | The foreign (i.e., child) schema
name (or pattern) when used with a metadata command query.
<br><br>Supported metadata commands include: `GetCrossReference`. | |
| `adbc.apache.foreign_table_name` | The foreign (i.e., child) table
name (or pattern) when used with a metadata command query.
<br><br>Supported metadata commands include: `GetCrossReference`. | |
@birschick-bq birschick-bq deleted the dev/birschick-bq/metadata-commands branch June 11, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants