drill icon indicating copy to clipboard operation
drill copied to clipboard

Snowflake - adopt JDBC parameter CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX

Open jaceksan opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. I specify JDBC URL like this: jdbc:snowflake://<account>.snowflakecomputing.com:443?warehouse=<warehouse>&db=<db>&CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX=true

Despite I use CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX=true , INFORMATION_SCHEMA.SCHEMATA contains schemata from all warehouses and databases (the user has access to everywhere).

In our platform, when I use this parameter and I call e.g. dbMetadata.getTables() , it collects only tables from corresponding warehouse and database.

Querying all warehouses can be very expensive causing SELECT from Drill INFORMATION_SCHEMA takes ages.

Describe the solution you'd like Parameter CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX is properly propagated to the connection from Drill to Snowflake, only objects from warehouse/database specified in the JDBC URL are populated into Drill INFORMATION_SCHEMA.

Describe alternatives you've considered The only workaround solution is to limit privileges of DB user (what warehouses/databases he can see). This is not a valid workaround in our case (testing user has read access to huge number of testing warehouses/databases).

jaceksan avatar Oct 04 '21 07:10 jaceksan

Hi, I do believe that any JDBC URL parameters that you put in a storage config will be passed through to the JDBC driver unmodified by Drill. Are you able to run the following test for us? It could be that the way that Drill collects metadata is not governed by CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX...

Connection con = // obtain a connection using desired URL params
ResultSet rs = con.getMetaData().getCatalogs();
// are all catalogs returned in rs?

jnturton avatar Mar 18 '22 13:03 jnturton