Error: Failed to create ADBC connection for driver databricks: Failed to create database…
- User
Error: Failed to create ADBC connection for driver databricks: Failed to create database handle: InvalidArguments: cannot specify both URI and individual connection options (sqlstate: [0, 0, 0, 0, 0], vendor_code: -2147483648)
Because in
system-adapters/databricks/src/main.rsfn setup, we use bothuriandcatalogandschemaas options. catalog and schema must be in uri query path.databricks://token:@:/?<param1=value1>&<param2=value2>
Components:
scheme: databricks:// (required)
: (required) Databricks personal access token.
: (required) Server Hostname value.
port-number: (required) Port value, which is typically 443.
http-path: (required) HTTP Path value.
Query params: Databricks connection attributes. For complete list of optional parameters, see Databricks Optional Parameters
Supported optional connection parameters can be specified in <param=value>. Some of the more frequently used ones include: catalog: Sets the initial catalog name in the session. schema: Sets the initial schema name in the session. maxRows: Sets up the maximum number of rows fetched per request. The default is 10000. timeout: Adds the timeout (in seconds) for the server query execution. The default is no timeout. userAgentEntry: Used to identify partners. For more information, see your partner's documentation. Supported optional session parameters can be specified in param=value. Some of the more frequently used ones include: ansi_mode: A Boolean string. true for session statements to adhere to rules specified by the ANSI SQL specification. The system default is false. timezone: A string, for example America/Los_Angeles. Sets the timezone of the session. The system default is UTC. query_tags: A string of comma-separated key:value pairs to attach to SQL queries for tracking in system.query.history, for example, team:engineering,dashboard:abc123. This feature is in Private Preview. To request access, contact your account team.
Assistant
I can see the issue. In the
setupmethod (line 1074-1084), thedb_kwargsreturnsuri,catalog, andschemaas separate keys. The ADBC Databricks driver doesn't allow both auriand individual connection options likecatalog/schema— they must be encoded as query parameters in the URI.I need to:
- Update
databricks_uri()to accept catalog/schema and include them as query params - Remove
catalogandschemafromdb_kwargsin setup
- Update
Assistant
Now let me check if
urlencodingis already a dependency.Assistant
Need to add
urlencoding:Assistant
Let me verify it compiles.
Assistant
Compiles successfully. Now let me add the comment the user requested.
Assistant
Here's a summary of the changes:
-
databricks_uri()(line 353): Now includescatalogandschemaas query parameters in the URI, e.g.databricks://token:...@host:443/path?catalog=foo&schema=bar. Values are URL-encoded via theurlencodingcrate. -
setup()return (line 1072-1079): Removed the separatecatalogandschemakeys fromdb_kwargs, keeping onlyuri. Added a comment explaining the ADBC driver constraint. -
Cargo.toml: Addedurlencoding = "2"dependency.
-