How to reference variables inside sqlrunner .sql scripts


Hi all,
How do I insert a variable into a .sql script that is run by sqlrunner?

I’m using the .sql script example here as reference.

Here’s what I have so far, along with the error I’m seeing:

/var/snowplow-sqlrunner/sql-runner -var var1=schema1 -playbook /path/to/playbook.yml

  - :name:     "name"
    :type:     postgresql
    :host:     localhost
    :database: warehouse
    :port:     5432
    :username: abcd
    :password: 1234
  - :name: "01"
      - :name: "query"
        :file: ./script.sql
INSERT INTO {{.var1}}.mytable ......

Error output
ERROR #42601 syntax error at or near "{"



You are using variables. To recognize them, you need to add :template: true as per


@ihor - That did it, thanks!


can I override playbook variables from command line

/var/snowplow-sqlrunner/sql-runner -var -playbook /path/to/playbook.yml