Skip to content

Conversation

@shivam2680
Copy link
Contributor

Description

This PR adds support for metric view metadata in the Databricks SQL Node.js driver, following the JDBC driver implementation.

Changes

  • Added enableMetricViewMetadata optional boolean to ConnectionOptions interface
  • Added enableMetricViewMetadata optional boolean to ClientConfig interface
  • Updated DBSQLClient.connect() to store the configuration
  • Updated DBSQLClient.openSession() to inject spark.sql.thriftserver.metadata.metricview.enabled=true when enabled
  • Added 6 comprehensive unit tests

Behavior

When enableMetricViewMetadata=true:

  • getTables() and getTableTypes() will include METRIC_VIEW entries
  • getColumns() will return measure columns with <data_type> measure format in TYPE_NAME

Usage

const client = new DBSQLClient();

await client.connect({
  host: 'your-workspace.cloud.databricks.com',
  path: '/sql/protocolv1/o/...',
  token: 'dapi***',
  enableMetricViewMetadata: true
});

const session = await client.openSession();

Testing

All 437 unit tests pass including 6 new tests for this feature.

Backward Compatibility

Feature is disabled by default - fully backward compatible.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for metric view metadata in the Databricks SQL Node.js driver by introducing a new configuration option that enables retrieval of metric view information through metadata methods. When enabled, the driver injects a Spark configuration parameter during session creation.

Key Changes:

  • Added enableMetricViewMetadata configuration option to connection and client interfaces
  • Modified session opening logic to conditionally inject the Spark configuration parameter
  • Added comprehensive test coverage for the new feature

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
lib/contracts/IDBSQLClient.ts Added enableMetricViewMetadata optional property to ConnectionOptions interface
lib/contracts/IClientContext.ts Added enableMetricViewMetadata optional property to ClientConfig interface
lib/DBSQLClient.ts Stored configuration and injected session parameter when metric view metadata is enabled
tests/unit/DBSQLClient.test.ts Added 6 unit tests covering configuration storage, parameter injection, and user configuration preservation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@shivam2680 shivam2680 merged commit 00f55c7 into main Oct 24, 2025
19 of 22 checks passed
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.

4 participants