From dbc3b2b5332d4e2d3549a33a3cfc38c4ead09e8e Mon Sep 17 00:00:00 2001 From: Tristen Harr Date: Wed, 15 Jan 2025 19:48:42 -0600 Subject: [PATCH] fix filtering on relationships --- CHANGELOG.md | 3 +++ connector-definition/connector-metadata.yaml | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- src/handlers/query.ts | 3 +-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fcfc73..b598da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # DuckDB Connector Changelog This changelog documents changes between release tags. +## [0.1.7] - 2025-01-15 +* Fix filtering across relationships + ## [0.1.6] - 2025-01-15 * Fix github workflow diff --git a/connector-definition/connector-metadata.yaml b/connector-definition/connector-metadata.yaml index 8bfde2c..862db4c 100644 --- a/connector-definition/connector-metadata.yaml +++ b/connector-definition/connector-metadata.yaml @@ -1,13 +1,13 @@ packagingDefinition: type: PrebuiltDockerImage - dockerImage: ghcr.io/hasura/ndc-duckdb:v0.1.6 + dockerImage: ghcr.io/hasura/ndc-duckdb:v0.1.7 supportedEnvironmentVariables: - name: DUCKDB_URL description: The url for the DuckDB database commands: update: type: Dockerized - dockerImage: ghcr.io/hasura/ndc-duckdb:v0.1.6 + dockerImage: ghcr.io/hasura/ndc-duckdb:v0.1.7 commandArgs: - update dockerComposeWatch: diff --git a/package-lock.json b/package-lock.json index 10acd2f..0b47eb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "duckdb-sdk", - "version": "0.1.6", + "version": "0.1.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "duckdb-sdk", - "version": "0.1.6", + "version": "0.1.7", "dependencies": { "@hasura/ndc-sdk-typescript": "^6.0.0", "duckdb": "^1.0.0", diff --git a/package.json b/package.json index 7d72c17..f03765f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "duckdb-sdk", - "version": "0.1.6", + "version": "0.1.7", "description": "", "main": "index.js", "scripts": { diff --git a/src/handlers/query.ts b/src/handlers/query.ts index 1b1ec55..225f0c5 100644 --- a/src/handlers/query.ts +++ b/src/handlers/query.ts @@ -308,7 +308,7 @@ function build_where( subquery_sql = ` SELECT 1 FROM ${from_collection_alias} AS ${escape_double(subquery_alias)} - WHERE ${predicate ? build_where(predicate, collection_relationships, args, variables, prefix, collection_aliases, config, query_request) : '1 = 1'} + WHERE ${predicate ? build_where(predicate, collection_relationships, args, variables, subquery_alias, collection_aliases, config, query_request) : '1 = 1'} AND ${Object.entries(relationship.column_mapping).map(([from, to]) => { return `${escape_double(prefix)}.${escape_double(from)} = ${escape_double(subquery_alias)}.${escape_double(to)}`; }).join(" AND ")} @@ -594,7 +594,6 @@ export async function do_query( state: State, query: QueryRequest ): Promise { - // console.log(JSON.stringify(query, null, 4)); let query_plans = await plan_queries(configuration, query); return await perform_query(state, query_plans); }