-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vertica-driver): Introduce VerticaDriver (#9081)
* feat(vertica-driver): VerticaDriver * fixed linter error * fix dependencies versions * driver & smoke tests * vertica driver added to integration tests * add vertica to smoke test * update packages * vertica driver published * vertica driver * update README.md * docker installation instruction * up version * update README and package refs * add cube build pipeline * remove * Added Query Implementation (#2) * Added custom dialect for CubeDriver * Sql fixes (#5) * Additional sql fixes (#6) * draft * update test * fix build * update vertica driver dependencies * vertica documentation * add vertica to data sources * fix lint errors * update jest * include vertica tests * update wait strategy and test shared package * change version of vertica driver * some ci-related fixes * fix version, names, refs to align with the Cube repo * update yarn.lock * fix old refs --------- Co-authored-by: Eduard Karacharov <eduard.karacharov@gmail.com> Co-authored-by: timbrownls20 <timbrownls26@hotmail.com> Co-authored-by: Roger <qi.chen@knowitall.net.au> Co-authored-by: David O'Bryen <dj.obryen@gmail.com>
- Loading branch information
1 parent
cd91f7d
commit c43340d
Showing
34 changed files
with
11,508 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
# Debug log for test containers | ||
export DEBUG=testcontainers | ||
|
||
export TEST_VERTICA_VERSION=12.0.4-0 | ||
|
||
echo "::group::Vertica ${TEST_VERTICA_VERSION}" | ||
docker pull vertica/vertica-ce:${TEST_VERTICA_VERSION} | ||
yarn lerna run --concurrency 1 --stream --no-prefix integration:vertica | ||
echo "::endgroup::" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Vertica | ||
|
||
## Prerequisites | ||
|
||
- The hostname for the [Vertica][vertica] database server | ||
- The username/password for the [Vertica][vertica] database server | ||
- The name of the database to use within the [Vertica][vertica] database server | ||
|
||
## Setup | ||
|
||
### Manual | ||
|
||
Add the following to a `.env` file in your Cube project: | ||
|
||
```dotenv | ||
CUBEJS_DB_TYPE=vertica | ||
CUBEJS_DB_HOST=my.vertica.host | ||
CUBEJS_DB_USER=vertica_user | ||
CUBEJS_DB_PASS=********** | ||
CUBEJS_DB_SCHEMA=my_vertica_schema | ||
``` | ||
|
||
## Environment Variables | ||
|
||
| Environment Variable | Description | Possible Values | Required | | ||
| -------------------------- | ----------------------------------------------------------------------------------- | --------------------------------------------- | :------: | | ||
| `CUBEJS_DB_HOST` | The host URL for a database | A valid database host URL | ✅ | | ||
| `CUBEJS_DB_PORT` | The port for the database connection | A valid port number | ❌ | | ||
| `CUBEJS_DB_USER` | The username used to connect to the database | A valid database username | ✅ | | ||
| `CUBEJS_DB_PASS` | The password used to connect to the database | A valid database password | ✅ | | ||
| `CUBEJS_DB_SCHEMA` | The schema within the database to connect to | A valid schema name within a Presto database | ✅ | | ||
| `CUBEJS_DB_SSL` | If `true`, enables SSL encryption for database connections from Cube | `true`, `false` | ❌ | | ||
| `CUBEJS_CONCURRENCY` | The number of concurrent connections each queue has to the database. Default is `2` | A valid number | ❌ | | ||
| `CUBEJS_DB_MAX_POOL` | The maximum number of concurrent database connections to pool. Default is `8` | A valid number | ❌ | | ||
|
||
|
||
## SSL | ||
|
||
To enable SSL-encrypted connections between Cube and Verica, set the | ||
`CUBEJS_DB_SSL` environment variable to `true`. For more information on how to | ||
configure custom certificates, please check out [Enable SSL Connections to the | ||
Database][ref-recipe-enable-ssl]. | ||
|
||
[vertica]: https://www.vertica.com/documentation/vertica/all/ | ||
[ref-recipe-enable-ssl]:/guides/recipes/data-sources/using-ssl-connections-to-data-source | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
packages/cubejs-testing-shared/src/db-container-runners/oracle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/cubejs-testing-shared/src/db-container-runners/vertica.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { GenericContainer, Wait } from 'testcontainers'; | ||
import { DbRunnerAbstract } from './db-runner.abstract'; | ||
|
||
export class VerticaDBRunner extends DbRunnerAbstract { | ||
public static startContainer() { | ||
const version = process.env.TEST_VERTICA_VERSION || '12.0.4-0'; | ||
|
||
const container = new GenericContainer(`vertica/vertica-ce:${version}`) | ||
.withEnvironment({ TZ: 'Antarctica/Troll', VERTICA_DB_NAME: 'test', VMART_ETL_SCRIPT: '', VMART_ETL_SQL: '' }) | ||
.withExposedPorts(5433) | ||
.withStartupTimeout(60 * 1000) | ||
.withWaitStrategy( | ||
Wait.forLogMessage('Vertica is now running') | ||
); | ||
|
||
return container.start(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: "2.2" | ||
|
||
services: | ||
cube: | ||
container_name: birdbox-cube | ||
image: ${BIRDBOX_CUBEJS_REGISTRY_PATH}cubejs/cube:${BIRDBOX_CUBEJS_VERSION:-latest} | ||
environment: | ||
CUBEJS_DB_TYPE: vertica | ||
|
||
CUBEJS_DB_HOST: db | ||
CUBEJS_DB_PORT: 5433 | ||
CUBEJS_DB_NAME: vmart | ||
CUBEJS_DB_USER: dbadmin | ||
CUBEJS_DB_PASS: | ||
|
||
CUBEJS_DEV_MODE: "true" | ||
CUBEJS_WEB_SOCKETS: "true" | ||
CUBEJS_API_SECRET: mysupersecret | ||
volumes: | ||
- ./vertica/schema:/cube/conf/schema | ||
ports: | ||
- "4000" | ||
depends_on: | ||
db: | ||
condition: service_healthy | ||
links: | ||
- db | ||
restart: always | ||
|
||
# Database instances, for troubleshooting. | ||
# NOT required. | ||
# Tests provide db instances via testcontainers, in both LOCAL and DOCKER modes. | ||
|
||
db: | ||
container_name: birdbox-db | ||
image: vertica/vertica-ce:12.0.4-0 | ||
ports: | ||
- "5433" | ||
restart: always | ||
healthcheck: | ||
test: ["CMD-SHELL", "/opt/vertica/bin/vsql -c 'select 1;' || exit 1"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 |
34 changes: 34 additions & 0 deletions
34
packages/cubejs-testing/birdbox-fixtures/vertica/schema/Orders.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cube(`Orders`, { | ||
sql: ` | ||
with orders as ( | ||
select 1 as id, 100 as amount, 'new' status | ||
UNION ALL | ||
select 2 as id, 200 as amount, 'new' status | ||
UNION ALL | ||
select 3 as id, 300 as amount, 'processed' status | ||
UNION ALL | ||
select 4 as id, 500 as amount, 'processed' status | ||
UNION ALL | ||
select 5 as id, 600 as amount, 'shipped' status | ||
) | ||
select * from orders | ||
`, | ||
measures: { | ||
count: { | ||
type: `count`, | ||
}, | ||
totalAmount: { | ||
sql: `amount`, | ||
type: `sum`, | ||
}, | ||
toRemove: { | ||
type: `count`, | ||
}, | ||
}, | ||
dimensions: { | ||
status: { | ||
sql: `status`, | ||
type: `string`, | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.