diff --git a/packages/@dataform/assertion_utils/BUILD b/packages/@dataform/assertion_utils/BUILD deleted file mode 100644 index 08a2d1383..000000000 --- a/packages/@dataform/assertion_utils/BUILD +++ /dev/null @@ -1,35 +0,0 @@ -load("//tools:ts_library.bzl", "ts_library") -load("//:version.bzl", "DF_VERSION") -load("//packages:index.bzl", "pkg_json", "pkg_npm_tar") - -package(default_visibility = ["//visibility:public"]) - -ts_library( - name = "assertion_utils", - srcs = glob(["**/*.ts"]), - deps = [ - "@npm//@types/node", - ], -) - -pkg_json( - name = "json", - package_name = "@dataform/assertion_utils", - description = "Assertion utilities for Dataform.", - external_deps = [], - layers = [ - "//:package.json", - "//packages/@dataform:package.layer.json", - ], - main = "index.js", - types = "index.d.ts", - version = DF_VERSION, -) - -pkg_npm_tar( - name = "package", - deps = [ - ":assertion_utils", - ":package.json", - ], -) diff --git a/packages/@dataform/assertion_utils/index.ts b/packages/@dataform/assertion_utils/index.ts deleted file mode 100644 index 28e57a6f1..000000000 --- a/packages/@dataform/assertion_utils/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -export function forDataset(dataset: string) { - return new DatasetAssertion(dataset); -} - -export class DatasetAssertion { - private readonly dataset: string; - private groupCols: string[] = []; - constructor(dataset: string) { - this.dataset = dataset; - } - - public groupedBy(cols: string | string[]) { - this.groupCols = typeof cols === "string" ? [cols] : cols; - return this; - } - - public getUniqueRowQuery(): string { - return ` - WITH base AS ( - - SELECT - ${this.groupCols.join(", ")}, - SUM(1) as row_count - FROM ${this.dataset} - GROUP BY - ${this.groupCols.join(", ")} - ) - - SELECT - * - FROM - base - WHERE - row_count > 1 - `; - } - - public getNotNullQuery(field: string): string { - return ` - SELECT - * - FROM ${this.dataset} - WHERE - ${field} IS NULL - ` - } - - public getAcceptedValuesQuery(field: string, acceptedValues: string | string[]): string { - return ` - SELECT - * - FROM ${this.dataset} - WHERE - ${field} NOT IN ${acceptedValues} - ` - } -} diff --git a/packages/@dataform/assertion_utils/tslint.json b/packages/@dataform/assertion_utils/tslint.json deleted file mode 100644 index a24df6a4d..000000000 --- a/packages/@dataform/assertion_utils/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": ["../../../tslint.json"], - "rules": { - "tsr-detect-sql-literal-injection": false - } -} diff --git a/scripts/publish b/scripts/publish index a298791bc..2f59a627b 100755 --- a/scripts/publish +++ b/scripts/publish @@ -15,7 +15,6 @@ fi bazel test //... --build_tests_only -- -tests/integration:snowflake.spec -bazel run packages/@dataform/assertion_utils:package.publish bazel run packages/@dataform/cli:package.publish bazel run packages/@dataform/core:package.publish bazel run cli:push diff --git a/tests/integration/bigquery.spec.ts b/tests/integration/bigquery.spec.ts index d1e428507..110c33e37 100644 --- a/tests/integration/bigquery.spec.ts +++ b/tests/integration/bigquery.spec.ts @@ -41,11 +41,10 @@ suite("@dataform/integration/bigquery", { parallel: true }, ({ before, after }) const executedGraph = await dfapi.run(dbadapter, executionGraph).result(); const actionMap = keyBy(executedGraph.actions, v => targetAsReadableString(v.target)); - expect(Object.keys(actionMap).length).eql(19); + expect(Object.keys(actionMap).length).eql(17); // Check the status of action execution. const expectedFailedActions = [ - "dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_uniqueness_fail", "dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_fail", "dataform-integration-tests.df_integration_test_eu_project_e2e.example_operation_partial_fail" ]; @@ -61,7 +60,7 @@ suite("@dataform/integration/bigquery", { parallel: true }, ({ before, after }) expect( actionMap[ - "dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_uniqueness_fail" + "dataform-integration-tests.df_integration_test_eu_assertions_project_e2e.example_assertion_fail" ].tasks[1].errorMessage ).to.eql("bigquery error: Assertion failed: query returned 1 row(s)."); diff --git a/tests/integration/bigquery_project/BUILD b/tests/integration/bigquery_project/BUILD index af5ae241e..e1fafe2e3 100644 --- a/tests/integration/bigquery_project/BUILD +++ b/tests/integration/bigquery_project/BUILD @@ -12,7 +12,6 @@ filegroup( node_modules( name = "node_modules", deps = [ - "//packages/@dataform/assertion_utils:package_tar", "//packages/@dataform/core:package_tar", ], ) diff --git a/tests/integration/bigquery_project/definitions/example_assertion_fail.assert.sql b/tests/integration/bigquery_project/definitions/example_assertion_fail.assert.sql deleted file mode 100644 index 393673f8b..000000000 --- a/tests/integration/bigquery_project/definitions/example_assertion_fail.assert.sql +++ /dev/null @@ -1 +0,0 @@ -select * from ${ref("sample_data")} diff --git a/tests/integration/bigquery_project/definitions/example_assertion_fail.sqlx b/tests/integration/bigquery_project/definitions/example_assertion_fail.sqlx new file mode 100644 index 000000000..cd3100236 --- /dev/null +++ b/tests/integration/bigquery_project/definitions/example_assertion_fail.sqlx @@ -0,0 +1,8 @@ +config { + type: "assertion" +} + +WITH base AS ( + SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/bigquery_project/definitions/example_assertion_pass.sqlx b/tests/integration/bigquery_project/definitions/example_assertion_pass.sqlx index 0fe862e05..338da985e 100644 --- a/tests/integration/bigquery_project/definitions/example_assertion_pass.sqlx +++ b/tests/integration/bigquery_project/definitions/example_assertion_pass.sqlx @@ -1,5 +1,8 @@ -config { type: "assertion" } +config { + type: "assertion" +} -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()} +WITH base AS ( + SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/bigquery_project/definitions/example_assertion_uniqueness_fail.sqlx b/tests/integration/bigquery_project/definitions/example_assertion_uniqueness_fail.sqlx deleted file mode 100644 index 5252a28fd..000000000 --- a/tests/integration/bigquery_project/definitions/example_assertion_uniqueness_fail.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1"]).getUniqueRowQuery()} diff --git a/tests/integration/bigquery_project/definitions/example_assertion_uniqueness_pass.sqlx b/tests/integration/bigquery_project/definitions/example_assertion_uniqueness_pass.sqlx deleted file mode 100644 index 6816d5a12..000000000 --- a/tests/integration/bigquery_project/definitions/example_assertion_uniqueness_pass.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1", "val2"]).getUniqueRowQuery()} diff --git a/tests/integration/bigquery_project/definitions/sample_data.sqlx b/tests/integration/bigquery_project/definitions/sample_data.sqlx index 0e8dc7bb5..fdd52e59c 100644 --- a/tests/integration/bigquery_project/definitions/sample_data.sqlx +++ b/tests/integration/bigquery_project/definitions/sample_data.sqlx @@ -1,6 +1,6 @@ config { type: "view", - hermetic: false, + hermetic: false } select ${when(dataform.projectConfig.vars.fooVar === "bar", "1", "2")} as val union all diff --git a/tests/integration/postgres.spec.ts b/tests/integration/postgres.spec.ts index c542f76ef..77fd51068 100644 --- a/tests/integration/postgres.spec.ts +++ b/tests/integration/postgres.spec.ts @@ -37,11 +37,10 @@ suite("@dataform/integration/postgres", { parallel: true }, ({ before, after }) let executedGraph = await dfapi.run(dbadapter, executionGraph).result(); const actionMap = keyBy(executedGraph.actions, v => targetAsReadableString(v.target)); - expect(Object.keys(actionMap).length).eql(13); + expect(Object.keys(actionMap).length).eql(11); // Check the status of action execution. const expectedFailedActions = [ - "df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail", "df_integration_test_assertions_project_e2e.example_assertion_fail" ]; for (const actionName of Object.keys(actionMap)) { @@ -55,8 +54,8 @@ suite("@dataform/integration/postgres", { parallel: true }, ({ before, after }) } expect( - actionMap["df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail"] - .tasks[2].errorMessage + actionMap["df_integration_test_assertions_project_e2e.example_assertion_fail"].tasks[2] + .errorMessage ).to.eql("postgres error: Assertion failed: query returned 1 row(s)."); // Check the data in the incremental table. diff --git a/tests/integration/postgres_project/BUILD b/tests/integration/postgres_project/BUILD index af5ae241e..e1fafe2e3 100644 --- a/tests/integration/postgres_project/BUILD +++ b/tests/integration/postgres_project/BUILD @@ -12,7 +12,6 @@ filegroup( node_modules( name = "node_modules", deps = [ - "//packages/@dataform/assertion_utils:package_tar", "//packages/@dataform/core:package_tar", ], ) diff --git a/tests/integration/postgres_project/definitions/example_assertion_fail.assert.sql b/tests/integration/postgres_project/definitions/example_assertion_fail.assert.sql deleted file mode 100644 index 393673f8b..000000000 --- a/tests/integration/postgres_project/definitions/example_assertion_fail.assert.sql +++ /dev/null @@ -1 +0,0 @@ -select * from ${ref("sample_data")} diff --git a/tests/integration/postgres_project/definitions/example_assertion_fail.sqlx b/tests/integration/postgres_project/definitions/example_assertion_fail.sqlx new file mode 100644 index 000000000..cd3100236 --- /dev/null +++ b/tests/integration/postgres_project/definitions/example_assertion_fail.sqlx @@ -0,0 +1,8 @@ +config { + type: "assertion" +} + +WITH base AS ( + SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/postgres_project/definitions/example_assertion_pass.sqlx b/tests/integration/postgres_project/definitions/example_assertion_pass.sqlx index 0fe862e05..338da985e 100644 --- a/tests/integration/postgres_project/definitions/example_assertion_pass.sqlx +++ b/tests/integration/postgres_project/definitions/example_assertion_pass.sqlx @@ -1,5 +1,8 @@ -config { type: "assertion" } +config { + type: "assertion" +} -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()} +WITH base AS ( + SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/postgres_project/definitions/example_assertion_uniqueness_fail.sqlx b/tests/integration/postgres_project/definitions/example_assertion_uniqueness_fail.sqlx deleted file mode 100644 index 5252a28fd..000000000 --- a/tests/integration/postgres_project/definitions/example_assertion_uniqueness_fail.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1"]).getUniqueRowQuery()} diff --git a/tests/integration/postgres_project/definitions/example_assertion_uniqueness_pass.sqlx b/tests/integration/postgres_project/definitions/example_assertion_uniqueness_pass.sqlx deleted file mode 100644 index 6816d5a12..000000000 --- a/tests/integration/postgres_project/definitions/example_assertion_uniqueness_pass.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1", "val2"]).getUniqueRowQuery()} diff --git a/tests/integration/presto_project/BUILD b/tests/integration/presto_project/BUILD index af5ae241e..e1fafe2e3 100644 --- a/tests/integration/presto_project/BUILD +++ b/tests/integration/presto_project/BUILD @@ -12,7 +12,6 @@ filegroup( node_modules( name = "node_modules", deps = [ - "//packages/@dataform/assertion_utils:package_tar", "//packages/@dataform/core:package_tar", ], ) diff --git a/tests/integration/redshift.spec.ts b/tests/integration/redshift.spec.ts index f15b83b08..6ac32ccfe 100644 --- a/tests/integration/redshift.spec.ts +++ b/tests/integration/redshift.spec.ts @@ -41,7 +41,6 @@ suite("@dataform/integration/redshift", { parallel: true }, ({ before, after }) // Check the status of action execution. const expectedFailedActions = [ - "df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail", "df_integration_test_assertions_project_e2e.example_assertion_fail" ]; for (const actionName of Object.keys(actionMap)) { @@ -55,8 +54,8 @@ suite("@dataform/integration/redshift", { parallel: true }, ({ before, after }) } expect( - actionMap["df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail"] - .tasks[2].errorMessage + actionMap["df_integration_test_assertions_project_e2e.example_assertion_fail"].tasks[2] + .errorMessage ).to.eql("redshift error: Assertion failed: query returned 1 row(s)."); // Check the status of the s3 load operation. diff --git a/tests/integration/redshift_project/BUILD b/tests/integration/redshift_project/BUILD index af5ae241e..e1fafe2e3 100644 --- a/tests/integration/redshift_project/BUILD +++ b/tests/integration/redshift_project/BUILD @@ -12,7 +12,6 @@ filegroup( node_modules( name = "node_modules", deps = [ - "//packages/@dataform/assertion_utils:package_tar", "//packages/@dataform/core:package_tar", ], ) diff --git a/tests/integration/redshift_project/definitions/example_assertion_fail.assert.sql b/tests/integration/redshift_project/definitions/example_assertion_fail.assert.sql deleted file mode 100644 index 393673f8b..000000000 --- a/tests/integration/redshift_project/definitions/example_assertion_fail.assert.sql +++ /dev/null @@ -1 +0,0 @@ -select * from ${ref("sample_data")} diff --git a/tests/integration/redshift_project/definitions/example_assertion_fail.sqlx b/tests/integration/redshift_project/definitions/example_assertion_fail.sqlx new file mode 100644 index 000000000..cd3100236 --- /dev/null +++ b/tests/integration/redshift_project/definitions/example_assertion_fail.sqlx @@ -0,0 +1,8 @@ +config { + type: "assertion" +} + +WITH base AS ( + SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/redshift_project/definitions/example_assertion_pass.sqlx b/tests/integration/redshift_project/definitions/example_assertion_pass.sqlx index 0fe862e05..338da985e 100644 --- a/tests/integration/redshift_project/definitions/example_assertion_pass.sqlx +++ b/tests/integration/redshift_project/definitions/example_assertion_pass.sqlx @@ -1,5 +1,8 @@ -config { type: "assertion" } +config { + type: "assertion" +} -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()} +WITH base AS ( + SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/redshift_project/definitions/example_assertion_uniqueness_fail.sqlx b/tests/integration/redshift_project/definitions/example_assertion_uniqueness_fail.sqlx deleted file mode 100644 index 5252a28fd..000000000 --- a/tests/integration/redshift_project/definitions/example_assertion_uniqueness_fail.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1"]).getUniqueRowQuery()} diff --git a/tests/integration/redshift_project/definitions/example_assertion_uniqueness_pass.sqlx b/tests/integration/redshift_project/definitions/example_assertion_uniqueness_pass.sqlx deleted file mode 100644 index 6816d5a12..000000000 --- a/tests/integration/redshift_project/definitions/example_assertion_uniqueness_pass.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1", "val2"]).getUniqueRowQuery()} diff --git a/tests/integration/snowflake.spec.ts b/tests/integration/snowflake.spec.ts index 931409d93..35a725a42 100644 --- a/tests/integration/snowflake.spec.ts +++ b/tests/integration/snowflake.spec.ts @@ -44,11 +44,10 @@ suite("@dataform/integration/snowflake", ({ before, after }) => { let executedGraph = await dfapi.run(dbadapter, executionGraph).result(); const actionMap = keyBy(executedGraph.actions, v => targetAsReadableString(v.target)); - expect(Object.keys(actionMap).length).eql(20); + expect(Object.keys(actionMap).length).eql(18); // Check the status of action execution. const expectedFailedActions = [ - "INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_UNIQUENESS_FAIL", "INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_FAIL" ]; for (const actionName of Object.keys(actionMap)) { @@ -65,7 +64,7 @@ suite("@dataform/integration/snowflake", ({ before, after }) => { expect( actionMap[ - "INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_UNIQUENESS_FAIL" + "INTEGRATION_TESTS.DF_INTEGRATION_TEST_ASSERTIONS_PROJECT_E2E.EXAMPLE_ASSERTION_FAIL" ].tasks[1].errorMessage ).to.eql("snowflake error: Assertion failed: query returned 1 row(s)."); diff --git a/tests/integration/snowflake_project/BUILD b/tests/integration/snowflake_project/BUILD index af5ae241e..e1fafe2e3 100644 --- a/tests/integration/snowflake_project/BUILD +++ b/tests/integration/snowflake_project/BUILD @@ -12,7 +12,6 @@ filegroup( node_modules( name = "node_modules", deps = [ - "//packages/@dataform/assertion_utils:package_tar", "//packages/@dataform/core:package_tar", ], ) diff --git a/tests/integration/snowflake_project/definitions/example_assertion_fail.assert.sql b/tests/integration/snowflake_project/definitions/example_assertion_fail.assert.sql deleted file mode 100644 index 393673f8b..000000000 --- a/tests/integration/snowflake_project/definitions/example_assertion_fail.assert.sql +++ /dev/null @@ -1 +0,0 @@ -select * from ${ref("sample_data")} diff --git a/tests/integration/snowflake_project/definitions/example_assertion_fail.sqlx b/tests/integration/snowflake_project/definitions/example_assertion_fail.sqlx new file mode 100644 index 000000000..cd3100236 --- /dev/null +++ b/tests/integration/snowflake_project/definitions/example_assertion_fail.sqlx @@ -0,0 +1,8 @@ +config { + type: "assertion" +} + +WITH base AS ( + SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/snowflake_project/definitions/example_assertion_pass.sqlx b/tests/integration/snowflake_project/definitions/example_assertion_pass.sqlx index 0fe862e05..338da985e 100644 --- a/tests/integration/snowflake_project/definitions/example_assertion_pass.sqlx +++ b/tests/integration/snowflake_project/definitions/example_assertion_pass.sqlx @@ -1,5 +1,8 @@ -config { type: "assertion" } +config { + type: "assertion" +} -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()} +WITH base AS ( + SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/snowflake_project/definitions/example_assertion_uniqueness_fail.sqlx b/tests/integration/snowflake_project/definitions/example_assertion_uniqueness_fail.sqlx deleted file mode 100644 index 5252a28fd..000000000 --- a/tests/integration/snowflake_project/definitions/example_assertion_uniqueness_fail.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1"]).getUniqueRowQuery()} diff --git a/tests/integration/snowflake_project/definitions/example_assertion_uniqueness_pass.sqlx b/tests/integration/snowflake_project/definitions/example_assertion_uniqueness_pass.sqlx deleted file mode 100644 index 6816d5a12..000000000 --- a/tests/integration/snowflake_project/definitions/example_assertion_uniqueness_pass.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1", "val2"]).getUniqueRowQuery()} diff --git a/tests/integration/sqldatawarehouse.spec.ts b/tests/integration/sqldatawarehouse.spec.ts index fee923214..1ff90028f 100644 --- a/tests/integration/sqldatawarehouse.spec.ts +++ b/tests/integration/sqldatawarehouse.spec.ts @@ -42,7 +42,6 @@ suite("@dataform/integration/sqldatawarehouse", { parallel: true }, ({ before, a // Check the status of action execution. const expectedFailedActions = [ - "df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail", "df_integration_test_assertions_project_e2e.example_assertion_fail" ]; for (const actionName of Object.keys(actionMap)) { @@ -53,8 +52,8 @@ suite("@dataform/integration/sqldatawarehouse", { parallel: true }, ({ before, a } expect( - actionMap["df_integration_test_assertions_project_e2e.example_assertion_uniqueness_fail"] - .tasks[2].errorMessage + actionMap["df_integration_test_assertions_project_e2e.example_assertion_fail"].tasks[2] + .errorMessage ).to.eql("sqldatawarehouse error: Assertion failed: query returned 1 row(s)."); // Check the data in the incremental table. diff --git a/tests/integration/sqldatawarehouse_project/BUILD b/tests/integration/sqldatawarehouse_project/BUILD index af5ae241e..e1fafe2e3 100644 --- a/tests/integration/sqldatawarehouse_project/BUILD +++ b/tests/integration/sqldatawarehouse_project/BUILD @@ -12,7 +12,6 @@ filegroup( node_modules( name = "node_modules", deps = [ - "//packages/@dataform/assertion_utils:package_tar", "//packages/@dataform/core:package_tar", ], ) diff --git a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_fail.sqlx b/tests/integration/sqldatawarehouse_project/definitions/example_assertion_fail.sqlx index fdc9055a2..cd3100236 100644 --- a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_fail.sqlx +++ b/tests/integration/sqldatawarehouse_project/definitions/example_assertion_fail.sqlx @@ -1,3 +1,8 @@ -config { type: "assertion" } +config { + type: "assertion" +} -select * from ${ref("sample_data")} +WITH base AS ( + SELECT val1, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_pass.sqlx b/tests/integration/sqldatawarehouse_project/definitions/example_assertion_pass.sqlx index 0fe862e05..338da985e 100644 --- a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_pass.sqlx +++ b/tests/integration/sqldatawarehouse_project/definitions/example_assertion_pass.sqlx @@ -1,5 +1,8 @@ -config { type: "assertion" } +config { + type: "assertion" +} -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data")).groupedBy(["val"]).getUniqueRowQuery()} +WITH base AS ( + SELECT val1, val2, SUM(1) as row_count FROM ${ref("sample_data_2")} GROUP BY val1, val2 +) +SELECT * FROM base WHERE row_count > 1 diff --git a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_uniqueness_fail.sqlx b/tests/integration/sqldatawarehouse_project/definitions/example_assertion_uniqueness_fail.sqlx deleted file mode 100644 index 5252a28fd..000000000 --- a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_uniqueness_fail.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1"]).getUniqueRowQuery()} diff --git a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_uniqueness_pass.sqlx b/tests/integration/sqldatawarehouse_project/definitions/example_assertion_uniqueness_pass.sqlx deleted file mode 100644 index 6816d5a12..000000000 --- a/tests/integration/sqldatawarehouse_project/definitions/example_assertion_uniqueness_pass.sqlx +++ /dev/null @@ -1,5 +0,0 @@ -config { type: "assertion" } - -js { const assertionUtils = require("@dataform/assertion_utils"); } - -${assertionUtils.forDataset(ref("sample_data_2")).groupedBy(["val1", "val2"]).getUniqueRowQuery()}