github dataform-co/dataform 2.3.0
2.3.0: Add a `database()` function in SQL templating

latest releases: 3.0.2, 3.0.1, 3.0.0...
19 months ago

Both SQLX and JavaScript now support a database() function, which returns the (prefixed, as applicable) name of "this" action's database. (Contrived) examples:

publish("table", ctx => `select "${ctx.database()}" as col1`);
config { type: "table" }
select "${database()}" as col1

Assuming dataform.config contains "defaultDatabase": "foo", these both generate a table action whose SQL is select "foo" as col1. This is likely most useful in type: "operations" scripts.

Note: For warehouses without databases such as Redshift, this will add an error to the compilationErrors property.

Bugfix: The similar name() function has been fixed to properly attach any prefix as appropriate.

Don't miss a new dataform release

NewReleases is sending notifications on new releases.