|
1 | 1 | import path from 'path'; |
2 | 2 | import { downloadAndExtractFile, getEnv } from '@cubejs-backend/shared'; |
3 | 3 |
|
4 | | -function acceptedByEnv() { |
5 | | - const acceptStatus = getEnv('databrickAcceptPolicy'); |
6 | | - if (acceptStatus) { |
7 | | - console.log('You accepted Terms & Conditions for JDBC driver from DataBricks by CUBEJS_DB_DATABRICKS_ACCEPT_POLICY'); |
8 | | - } |
9 | | - |
10 | | - if (acceptStatus === false) { |
11 | | - console.log('You declined Terms & Conditions for JDBC driver from DataBricks by CUBEJS_DB_DATABRICKS_ACCEPT_POLICY'); |
12 | | - console.log('Installation will be skipped'); |
13 | | - } |
14 | | - |
15 | | - return acceptStatus; |
16 | | -} |
17 | | - |
| 4 | +export const OSS_DRIVER_VERSION = '1.0.2'; |
| 5 | + |
| 6 | +/** |
| 7 | + * In the beginning of 2025 Databricks released their open-source version of JDBC driver and encourage |
| 8 | + * all users to migrate to it as company plans to focus on improving and evolving it over legacy simba driver. |
| 9 | + * More info about OSS Driver could be found at https://docs.databricks.com/aws/en/integrations/jdbc/oss |
| 10 | + * As of March 2025 To use the Databricks JDBC Driver (OSS), the following requirements must be met: |
| 11 | + * Java Runtime Environment (JRE) 11.0 or above. CI testing is supported on JRE 11, 17, and 21. |
| 12 | + */ |
18 | 13 | export async function downloadJDBCDriver(): Promise<string | null> { |
19 | | - const driverAccepted = acceptedByEnv(); |
20 | | - |
21 | | - if (driverAccepted) { |
22 | | - console.log('Downloading DatabricksJDBC42-2.6.29.1051'); |
| 14 | + // TODO: Just to throw a console warning that this ENV is obsolete and could be safely removed |
| 15 | + getEnv('databrickAcceptPolicy'); |
23 | 16 |
|
24 | | - await downloadAndExtractFile( |
25 | | - 'https://databricks-bi-artifacts.s3.us-east-2.amazonaws.com/simbaspark-drivers/jdbc/2.6.29/DatabricksJDBC42-2.6.29.1051.zip', |
26 | | - { |
27 | | - showProgress: true, |
28 | | - cwd: path.resolve(path.join(__dirname, '..', 'download')), |
29 | | - } |
30 | | - ); |
| 17 | + console.log(`Downloading databricks-jdbc-${OSS_DRIVER_VERSION}-oss.jar`); |
31 | 18 |
|
32 | | - console.log('Release notes: https://databricks-bi-artifacts.s3.us-east-2.amazonaws.com/simbaspark-drivers/jdbc/2.6.29/docs/release-notes.txt'); |
| 19 | + await downloadAndExtractFile( |
| 20 | + `https://repo1.maven.org/maven2/com/databricks/databricks-jdbc/${OSS_DRIVER_VERSION}-oss/databricks-jdbc-${OSS_DRIVER_VERSION}-oss.jar`, |
| 21 | + { |
| 22 | + showProgress: true, |
| 23 | + cwd: path.resolve(path.join(__dirname, '..', 'download')), |
| 24 | + noExtract: true, |
| 25 | + dstFileName: `databricks-jdbc-${OSS_DRIVER_VERSION}-oss.jar`, |
| 26 | + } |
| 27 | + ); |
33 | 28 |
|
34 | | - return path.resolve(path.join(__dirname, '..', 'download', 'DatabricksJDBC42.jar')); |
35 | | - } |
| 29 | + console.log(`Release notes: https://mvnrepository.com/artifact/com.databricks/databricks-jdbc/${OSS_DRIVER_VERSION}-oss`); |
36 | 30 |
|
37 | | - return null; |
| 31 | + return path.resolve(path.join(__dirname, '..', 'download', `databricks-jdbc-${OSS_DRIVER_VERSION}-oss.jar`)); |
38 | 32 | } |
0 commit comments