Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This PR adds databricks JDBC to the drivers supported by the plugin #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions plugins/nf-sqldb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ repositories {
configurations {
// see https://docs.gradle.org/4.1/userguide/dependency_management.html#sub:exclude_transitive_dependencies
runtimeClasspath.exclude group: 'org.slf4j', module: 'slf4j-api'
embeddedJar
}

sourceSets {
Expand All @@ -55,6 +56,8 @@ ext{
}

dependencies {
embeddedJar 'com.databricks:databricks-jdbc:0.9.8-oss'

compileOnly "io.nextflow:nextflow:$nextflowVersion"
compileOnly 'org.slf4j:slf4j-api:2.0.7'
compileOnly 'org.pf4j:pf4j:3.12.0'
Expand All @@ -67,6 +70,7 @@ dependencies {
api 'org.xerial:sqlite-jdbc:3.47.0.0'
api 'org.duckdb:duckdb_jdbc:0.10.2'

api files("$buildDir/filteredJars/databricks-jdbc-filtered-0.9.8-oss.jar")

// JDBC driver setup for AWS Athena - the 3rd party JAR are being downloaded and setup as gradle tasks below.
// Reference https://docs.aws.amazon.com/athena/latest/ug/connect-with-jdbc.html
Expand Down Expand Up @@ -128,5 +132,20 @@ task copyAthenDep(dependsOn: unzipAthenDep, type: Copy) {
from file(new File(buildDir, '/downloads/unzip/awsathena/SimbaAthenaJDBC-2.0.25.1001/AthenaJDBC42_2.0.25.1001.jar'))
into "src/dist/lib"
}

// Task to create a filtered JAR
task filteredJar(type: Jar) {
from {
zipTree(configurations.embeddedJar.singleFile).matching {
exclude 'org/slf4j/**' // Exclude SLF4J classes
}
}
archiveBaseName.set("databricks-jdbc-filtered")
archiveVersion.set("0.9.8-oss")
destinationDirectory.set(file("$buildDir/filteredJars"))
}

project.copyPluginLibs.dependsOn('copyAthenDep')
project.compileGroovy.dependsOn('copyAthenDep')
project.compileGroovy.dependsOn('filteredJar')
project.copyPluginLibs.dependsOn('filteredJar')
1 change: 1 addition & 0 deletions plugins/nf-sqldb/src/main/nextflow/sql/SqlPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ class SqlPlugin extends BasePlugin {

SqlPlugin(PluginWrapper wrapper) {
super(wrapper)
System.setProperty("com.databricks.jdbc.loggerImpl","SLF4JLOGGER")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class DriverRegistry {
drivers.'postgresql'= 'org.postgresql.Driver'
drivers.'duckdb'= 'org.duckdb.DuckDBDriver'
drivers.'awsathena'= 'com.simba.athena.jdbc.Driver'
drivers.'databricks'= 'com.databricks.client.jdbc.Driver'
}

void addDriver(String name, String driver){
Expand Down