Skip to content

Commit 462575f

Browse files
authored
Add the AWS Athena JDBC driver for nf-sqldb plugin (#2500)
1 parent 459ebab commit 462575f

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

plugins/nf-sqldb/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
plugins {
18+
id 'de.undercouch.download' version '4.1.2'
19+
}
20+
1621
apply plugin: 'java'
1722
apply plugin: 'java-test-fixtures'
1823
apply plugin: 'idea'
1924
apply plugin: 'groovy'
2025

26+
2127
sourceSets {
2228
main.java.srcDirs = []
2329
main.groovy.srcDirs = ['src/main']
@@ -36,17 +42,42 @@ dependencies {
3642
compileOnly project(':nextflow')
3743
compileOnly 'org.slf4j:slf4j-api:1.7.10'
3844
compileOnly 'org.pf4j:pf4j:3.4.1'
45+
compileOnly "org.slf4j:log4j-over-slf4j:1.7.32"
3946
api("org.codehaus.groovy:groovy-sql:3.0.9") { transitive = false }
4047
api 'com.h2database:h2:1.4.200'
4148
api 'mysql:mysql-connector-java:8.0.22'
4249
api 'org.mariadb.jdbc:mariadb-java-client:2.7.0'
4350
api 'org.postgresql:postgresql:42.2.23'
4451
api 'org.xerial:sqlite-jdbc:3.36.0.3'
4552
api 'org.duckdb:duckdb_jdbc:0.3.0'
53+
api files('downloads/unzip/AthenaJDBC42_2.0.25.1001.jar')
4654

4755
testImplementation(testFixtures(project(":nextflow")))
4856
testImplementation project(':nextflow')
4957
testImplementation "org.codehaus.groovy:groovy:3.0.9"
5058
testImplementation "org.codehaus.groovy:groovy-nio:3.0.9"
5159
}
5260

61+
62+
/**
63+
* The following tasks download and confirm the MD5 checksum of the ZIP archive
64+
* for Simba Athena JDBC driver and extract its contents to the build directory
65+
*/
66+
task downloadAthenDep(type: Download) {
67+
src 'https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC-2.0.25.1001/SimbaAthenaJDBC-2.0.25.1001.zip'
68+
dest new File(buildDir, 'downloads/SimbaAthenaJDBC-2.0.25.1001.zip')
69+
overwrite false
70+
}
71+
72+
task verifyAthenDep(type: Verify, dependsOn: downloadAthenDep) {
73+
src new File(buildDir, 'downloads/SimbaAthenaJDBC-2.0.25.1001.zip')
74+
algorithm 'MD5'
75+
checksum '71504d0317656d790978363358d0c068'
76+
}
77+
78+
task unzipAthenDep(dependsOn: verifyAthenDep, type: Copy) {
79+
from zipTree(new File(buildDir, 'downloads/SimbaAthenaJDBC-2.0.25.1001.zip'))
80+
into "${buildDir}/downloads/unzip"
81+
}
82+
83+
project.compileGroovy.dependsOn('unzipAthenDep')

plugins/nf-sqldb/src/main/nextflow/sql/config/SqlDataSource.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class SqlDataSource {
6565
case 'mariadb': return 'org.mariadb.jdbc.Driver'
6666
case 'postgresql': return 'org.postgresql.Driver'
6767
case 'duckdb': return 'org.duckdb.DuckDBDriver'
68+
case 'awsathena': return 'com.simba.athena.jdbc.Driver'
6869
}
6970
return null
7071
}

plugins/nf-sqldb/src/test/nextflow/sql/config/SqlDataSourceTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class SqlDataSourceTest extends Specification {
6969
'jdbc:mysql:some-host' | 'com.mysql.cj.jdbc.Driver'
7070
'jdbc:mariadb:other-host' | 'org.mariadb.jdbc.Driver'
7171
'jdbc:duckdb:' | 'org.duckdb.DuckDBDriver'
72+
'jdbc:awsathena:' | 'com.simba.athena.jdbc.Driver'
7273
}
7374

7475
def 'should get default config' () {

0 commit comments

Comments
 (0)