Custom Database Connection

How can I install and use a custom JDBC connection in Looker? From conversations with the Looker team, I know this wouldn’t be supported and could be broken by future Looker changes, but we would take responsibility to test the custom JDBC connection with Looker updates.

0 2 480
2 REPLIES 2

The issue really is that all of Looker’s SQL generation is hardcoded into the product and has nothing to do with the driver. Eg, to calculate a date diff in redshift, Looker needs to generate `DATEDIFF ( datepart, {date|time|timetz|timestamp}, {date|time|time|timestamp} )` but in BigQuery it needs to generate `DATE_DIFF(date_1, date_2, date_part)`. 

That out of the way, with the caveats you noted, yes it’s possible but only if you’re self-hosting. For logistic and legal reasons, we don’t allow uploading custom drivers to Looker hosted instances. If you’re self hosting, you can follow the instructions listed hereNote: Disregard the sentence ‘For Looker-hosted deployments, contact your Looker analyst for assistance.’ in the warning at the top. We no longer upload custom jars, so the support team won’t be able to assist in that regard. 

  

Hi James, 

Many thanks for your reply - that’s really helpful. To confirm, yes we are self-hosting.

We wouldn’t want to touch any of Looker SQL. The aim is to find a way to insert custom code between Looker and the JDBC connection that’s related to my other question:

https://community.looker.com/looker-api-77/support-for-external-permissioning-api-26666

We’d create a custom JDBC connection that’s wraps or extends another JDBC connection (in our case BigQuery). We’d need to override all of the execute methods (*) in Statement etc in order to run a permissions check. If allowed, we’d then call the underlying JDBC connection’s method and return the result. The Looker instance would see no difference compared to if it had called the JDBC connection directly itself. If not allowed, we’d probably throw a SQL Exception rather than return an empty ResultSet, but that’s an implementation detail. From the link you’ve provided, I think this will be achievable. 

(*) Which methods is a separate question that we’d work on as part of a POC.