dataform icon indicating copy to clipboard operation
dataform copied to clipboard

Assertions are not executed properly

Open kajen3 opened this issue 8 months ago • 0 comments

I've created a simple .sqlx file with the following content inside the definitions folder:

config {
    type: "table",
    schema: "dev",
    name: "revenue",
    assertions: {
        uniqueKeys: [
            ["date"],
            ["store"]
        ]
    }
}

SELECT
  date,
  store,
  net_revenue,
  net_revenue_food
FROM
  ${ref("store_revenue_view")}

While the query itself works fine, it seems that the assertions are not executed properly. The error message says:

Invalid value: Invalid dataset ID "...b0a.". Dataset IDs must be alphanumeric (plus underscores) and must be at most 1024 characters long. at [2:3] at [8:5] 

The dataset id is alphanumeric, but I've spotted a difference in the second line of the executed code. The code that fails (assertions) looks as follows:

BEGIN
  CREATE SCHEMA IF NOT EXISTS `...b0a.` OPTIONS(location="europe-west1");
...

while the first two lines of the job itself look as follows:

BEGIN
  CREATE SCHEMA IF NOT EXISTS `...b0a.dev` OPTIONS(location="europe-west1");
...

kajen3 avatar Jun 18 '24 08:06 kajen3