-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from Canner/feature/ds-bigquery
Feature: BigQuery support - statement
- Loading branch information
Showing
22 changed files
with
1,142 additions
and
59 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
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,78 @@ | ||
# BigQuery | ||
|
||
Connect with your bigquery servers via the official [Node.js Driver](https://cloud.google.com/nodejs/docs/reference/bigquery/latest). | ||
|
||
## Installation | ||
|
||
1. Install package | ||
|
||
```bash | ||
npm i @vulcan-sql/extension-driver-bq | ||
``` | ||
|
||
:::info | ||
If you run VulcanSQL with Docker, you should use the command `vulcan-install @vulcan-sql/extension-driver-bq` instead. | ||
|
||
::: | ||
|
||
2. Update `vulcan.yaml`, and enable the extension. | ||
|
||
```yaml | ||
extensions: | ||
... | ||
// highlight-next-line | ||
bq: '@vulcan-sql/extension-driver-bq' # Add this line | ||
``` | ||
3. Create a new profile in `profiles.yaml` or in your profile files. For example: | ||
:::info | ||
You can choose one from `keyFilename` or `credentials` to use. | ||
|
||
Your service account must have the following permissions to successfully execute queries. | ||
|
||
- BigQuery Data Viewer | ||
- BigQuery Job User | ||
|
||
> | ||
|
||
For details, please refer to [here](https://cloud.google.com/docs/authentication#service-accounts). | ||
::: | ||
|
||
with `keyFilename`: | ||
|
||
```yaml | ||
- name: bq # profile name | ||
type: bq | ||
connection: | ||
location: US | ||
projectId: 'your-project-id' | ||
keyFilename: '/path/to/keyfile.json' | ||
allow: '*' | ||
``` | ||
|
||
with `credential`: | ||
|
||
```yaml | ||
- name: bq # profile name | ||
type: bq | ||
connection: | ||
location: US | ||
projectId: 'your-project-id' | ||
credential: | ||
client_email: [email protected] | ||
private_key: '-----BEGIN PRIVATE KEY----- XXXXX -----END PRIVATE KEY-----\n' | ||
allow: '*' | ||
``` | ||
|
||
## Connection Configuration | ||
|
||
Please check [Interface BigQueryOptions](https://cloud.google.com/nodejs/docs/reference/bigquery/latest/bigquery/bigqueryoptions) and [Google BigQuery: Node.js Client](https://github.com/googleapis/nodejs-bigquery/blob/main/src/bigquery.ts#L173-L244) for further information. | ||
|
||
| Name | Required | Default | Description | | ||
| ------------------------ | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| location | N | US | Location must match that of the dataset(s) referenced in the query. | | ||
| projectId | N | | The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable `GCLOUD_PROJECT` for your project ID. If your app is running in an environment which [supports](https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application) Application Default Credentials, your project ID will be detected. | | ||
| keyFilename | N | | Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the `projectId` option above is not necessary. NOTE: .pem and .p12 require you to specify the `email` option as well. | | ||
| credentials | N | | Credentials object. | | ||
| credentials.client_email | N | | Your service account. | | ||
| credentials.private_key | N | | Your service account's private key. | |
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 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,54 @@ | ||
# extension-driver-bq | ||
|
||
[nodejs-bigquery](https://cloud.google.com/nodejs/docs/reference/bigquery/latest) driver for Vulcan SQL. | ||
|
||
## Install | ||
|
||
1. Install package | ||
|
||
```sql | ||
npm i @vulcan-sql/extension-driver-bq | ||
``` | ||
|
||
2. Update `vulcan.yaml`, enable the extension. | ||
|
||
```yaml | ||
extensions: | ||
bq: '@vulcan-sql/extension-driver-bq' | ||
``` | ||
3. Create a new profile in `profiles.yaml` or in your profiles' paths. | ||
|
||
> ⚠️ Your service account must have the following permissions to successfully execute queries. | ||
> | ||
> - BigQuery Data Viewer | ||
> - BigQuery Job User | ||
|
||
```yaml | ||
- name: bq # profile name | ||
type: bq | ||
connection: | ||
# Location must match that of the dataset(s) referenced in the query. | ||
location: US | ||
# Optional: The max rows we should fetch once. | ||
chunkSize: 100 | ||
# The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable `GCLOUD_PROJECT` for your project ID. If your app is running in an environment which [supports](https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application) Application Default Credentials), your project ID will be detected. | ||
projectId: 'your-project-id' | ||
# Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the `projectId` option above is not necessary. NOTE: .pem and .p12 require you to specify the `email` option as well. | ||
keyFilename: '/path/to/keyfile.json' | ||
``` | ||
## Testing | ||
```bash | ||
nx test extension-driver-bq | ||
``` | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
To run test, the following environment variables are required: | ||
|
||
- BQ_LOCATION | ||
- BQ_PROJECT_ID | ||
- BQ_CLIENT_EMAIL | ||
- BQ_PRIVATE_KEY |
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,14 @@ | ||
module.exports = { | ||
displayName: 'extension-driver-bq', | ||
preset: '../../jest.preset.ts', | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: '<rootDir>/tsconfig.spec.json', | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.[tj]s$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'js', 'html'], | ||
coverageDirectory: '../../coverage/packages/extension-driver-bq', | ||
}; |
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,29 @@ | ||
{ | ||
"name": "@vulcan-sql/extension-driver-bq", | ||
"description": "BigQuery driver for Vulcan SQL", | ||
"version": "0.3.0", | ||
"type": "commonjs", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"keywords": [ | ||
"vulcan", | ||
"vulcan-sql", | ||
"data", | ||
"sql", | ||
"database", | ||
"data-warehouse", | ||
"data-lake", | ||
"api-builder", | ||
"bigquery", | ||
"bq" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Canner/vulcan.git" | ||
}, | ||
"license": "MIT", | ||
"peerDependencies": { | ||
"@vulcan-sql/core": "~0.3.0-0" | ||
} | ||
} |
Oops, something went wrong.
642aeb7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
vulcan-sql-document – ./
vulcan-sql-document.vercel.app
vulcan-sql-document-git-main-vulcan-sql-document.vercel.app
vulcan-sql-document-vulcan-sql-document.vercel.app
www.vulcansql.com
vulcansql.com