soda-core icon indicating copy to clipboard operation
soda-core copied to clipboard

Resolve variables for user-defined checks

Open ssulca opened this issue 2 years ago • 2 comments

I would like use variables on user-defined checks queries, but it doesn't work.

# ${variable_name} doesn't work on user-defined checks queries

variables:
  TS_START: start date
  TS_END: end date 

checks for table:
  - count_column > 0 :
      count_column query: |
        select
           count(column)
        from "table"
        where created_at > '${TS_START}' and created_at < '${TS_END}'

resulting in

  |     cursor.execute(self.sql)
  | psycopg2.errors.InvalidDatetimeFormat: invalid input syntax for type timestamp: "${TS_START}"
  | LINE 4: where created_at > '${TS_START}' and created_at ...

ssulca avatar Jul 29 '22 01:07 ssulca

SODA-1012

jmarien avatar Jul 29 '22 01:07 jmarien

It would also be great if we can pass in variables to the standard checks as well like:

- row_count > ${row_count_threshold}:

albinkjellin avatar Aug 12 '22 12:08 albinkjellin

I believe the release of Soda Core 3.0.7 with a fix for 1577 resolves this issue. (Though the comment you made, @albinkjellin, is different and not resolved.

janet-can avatar Sep 13 '22 16:09 janet-can