Skip to content

Commit

Permalink
Add Databricks profile (#2339)
Browse files Browse the repository at this point in the history
* Create new webapi-databricks profile
* Check for spark and databricks connection string info
  • Loading branch information
anthonysena authored Feb 26, 2024
1 parent f258186 commit d90d653
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1482,6 +1482,17 @@
</plugins>
</build>
</profile>
<profile>
<id>webapi-databricks</id>
<dependencies>
<dependency>
<groupId>com.databricks</groupId>
<artifactId>databricks-jdbc</artifactId>
<version>2.6.34</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>webapi-bigquery</id>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ohdsi/webapi/DataAccessConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public DataSource primaryDataSource() {
//note autocommit defaults vary across vendors. use provided @Autowired TransactionTemplate

String[] supportedDrivers;
supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver", "org.apache.hive.jdbc.HiveDriver", "com.simba.spark.jdbc.Driver", "net.snowflake.client.jdbc.SnowflakeDriver"};
supportedDrivers = new String[]{"org.postgresql.Driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "oracle.jdbc.driver.OracleDriver", "com.amazon.redshift.jdbc.Driver", "com.cloudera.impala.jdbc.Driver", "net.starschema.clouddb.jdbc.BQDriver", "org.netezza.Driver", "com.simba.googlebigquery.jdbc42.Driver", "org.apache.hive.jdbc.HiveDriver", "com.simba.spark.jdbc.Driver", "net.snowflake.client.jdbc.SnowflakeDriver", "com.databricks.client.jdbc.Driver"};
for (String driverName : supportedDrivers) {
try {
Class.forName(driverName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public int[] doInStatement(Statement stmt) throws SQLException, DataAccessExcept
}
else {
for (int i = 0; i < sql.length; i++) {
if (stmt.getConnection().getMetaData().getURL().startsWith("jdbc:spark")) {
String connectionString = stmt.getConnection().getMetaData().getURL();
if (connectionString.startsWith("jdbc:spark") || connectionString.startsWith("jdbc:databricks")) {
this.currSql = BigQuerySparkTranslate.sparkHandleInsert(sql[i], stmt.getConnection());
if (this.currSql == "" || this.currSql.isEmpty() || this.currSql == null) {
rowsAffected[i] = -1;
Expand Down

0 comments on commit d90d653

Please sign in to comment.