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

fix issue#261 #268

Merged
merged 4 commits into from
Aug 3, 2023
Merged
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
3 changes: 2 additions & 1 deletion labs/playground1/.gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,5 @@ node_modules
result.json
spec-oas3.yaml
.vulcan-debug
dist
dist
tmp
12 changes: 11 additions & 1 deletion labs/playground1/Makefile
Original file line number Diff line number Diff line change
@@ -6,7 +6,10 @@ start: build test-data/moma.db ../../node_modules
@vulcan start

# build the required packages
build: pkg-core pkg-build pkg-serve pkg-catalog-server pkg-cli pkg-extension-driver-duckdb pkg-extension-authenticator-canner pkg-extension-driver-canner pkg-extension-driver-clickhouse pkg-extension-huggingface
build: pkg-core pkg-build pkg-serve pkg-catalog-server pkg-cli pkg-extension-driver-duckdb \
pkg-extension-authenticator-canner pkg-extension-driver-canner \
pkg-extension-driver-clickhouse pkg-extension-driver-bq \
pkg-extension-huggingface


# build for core pakge
@@ -71,6 +74,13 @@ pkg-extension-driver-clickhouse: ../../node_modules
cp -R ./dist/packages/extension-driver-clickhouse ./labs/playground1/node_modules/@vulcan-sql; \
cp -R ./packages/extension-driver-clickhouse/node_modules ./labs/playground1

pkg-extension-driver-bq: ../../node_modules
@cd ../..; \
yarn nx build extension-driver-bq; \
mkdir -p ./labs/playground1/node_modules/@vulcan-sql; \
rm -rf ./labs/playground1/node_modules/@vulcan-sql/extension-driver-bq; \
cp -R ./dist/packages/extension-driver-bq ./labs/playground1/node_modules/@vulcan-sql

pkg-extension-huggingface: ../../node_modules
@cd ../..; \
yarn nx build extension-huggingface; \
9 changes: 5 additions & 4 deletions labs/playground1/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "my-first-vulcan-project",
"dependencies": {
"@vulcan-sql/core": "0.2.0-dev.20220922.0",
"@vulcan-sql/extension-driver-duckdb": "0.2.0-dev.20220919.0",
"@vulcan-sql/serve": "0.2.0-dev.20220922.0"
"@vulcan-sql/core": "0.7.2",
"@vulcan-sql/extension-driver-duckdb": "0.7.2",
"@vulcan-sql/extension-driver-bq": "0.7.2",
"@vulcan-sql/serve": "0.7.2"
},
"devDependencies": {
"@vulcan-sql/build": "0.2.0-dev.20220922.0"
"@vulcan-sql/build": "0.7.2"
}
}
4 changes: 2 additions & 2 deletions labs/playground1/profile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- name: duck
- name: duckdb
type: duckdb
allow: "*"
connection:
persistent-path: ./test-data/moma.db
log-queries: true
log-parameters: true
allow: '*'
4 changes: 2 additions & 2 deletions labs/playground1/sqls/artist/artist.yaml
Original file line number Diff line number Diff line change
@@ -8,5 +8,5 @@ request:
sample:
parameters:
id: '1'
profile: duck
profile: duck
profile: duckdb
profile: duckdb
4 changes: 2 additions & 2 deletions labs/playground1/sqls/artist/works.yaml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ request:
sample:
parameters:
id: '1'
profile: duck
profile: duck
profile: duckdb
profile: duckdb
pagination:
mode: offset
8 changes: 6 additions & 2 deletions labs/playground1/vulcan.yaml
Original file line number Diff line number Diff line change
@@ -20,8 +20,6 @@ document-generator:
- oas3
types:
- RESTFUL
extensions:
duckdb: '@vulcan-sql/extension-driver-duckdb'
profiles:
- profile.yaml
rate-limit:
@@ -40,3 +38,9 @@ response-format:
formats:
- json
- csv
extensions:
duckdb: '@vulcan-sql/extension-driver-duckdb'
cache:
type: parquet
folderPath: tmp
loader: duckdb
1,315 changes: 898 additions & 417 deletions labs/playground1/yarn.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/extension-driver-bq/src/lib/bqDataSource.ts
Original file line number Diff line number Diff line change
@@ -82,7 +82,8 @@ export class BQDataSource extends DataSource<any, BQOptions> {
// Use the directory to avoid filename collision,
// The wildcard indicates the partition,
// ref: https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_option_list
const uri = `gs://${bucketName}/${directory}/part*.parquet`;
const bucketObjPrefix = path.join(bucketName, directory);
const uri = `gs://${path.join(bucketObjPrefix, 'part*.parquet')}`;
const queryOptions = {
query: `EXPORT DATA OPTIONS( uri="${uri}", format='PARQUET') AS ${statement}`,
location: options?.location || 'US',
@@ -91,7 +92,7 @@ export class BQDataSource extends DataSource<any, BQOptions> {
const [job] = await bigQuery.createQueryJob(queryOptions);
await this.runJobAndWait(job);
const getFilesResponse = await storage.bucket(bucketName).getFiles({
prefix: directory,
prefix: directory.slice(1), // remove the first slash
});
await Promise.all(
getFilesResponse[0].map(async (file) => {