Dataform Does Not Allow ${self()} in Function Names

Ideally I would have my devs use ${self()} when referring to the names of Operations in the SQL body and be strict on the config block, however, that throws a compilation error (Actions cannot resolve operations which do not produce output.). 

This is strange, as hardcoding the fully qualified name DOES work, and I can see in the side bar that they resolve to the same thing. Fails:

 

 

config {
    type: "operations",
    schema: dataform.projectConfig.vars.TARGET_SCHEMA,
    name: "BusinessDays_ufn",
    description: "Calculates the number of business days between two dates",
}

CREATE SCHEMA IF NOT EXISTS `${database()}.${schema()}`;

CREATE OR REPLACE FUNCTION
  `ActualProject.ActualSchema.BusinessDays_ufn` (pvStartDate DATE, pvEndDate DATE) AS ( 

 

 

Works:

 

 

config {
    type: "operations",
    schema: dataform.projectConfig.vars.TARGET_SCHEMA,
    name: "BusinessDays_ufn",
    description: "Calculates the number of business days between two dates",
}

CREATE SCHEMA IF NOT EXISTS `${database()}.${schema()}`;

CREATE OR REPLACE FUNCTION
  ${schema()} (pvStartDate DATE, pvEndDate DATE) AS ( 
  ...

 

 

Is this a bug?

Additionally, Dataform does not automatically create datasets for Operations, so I throw `

CREATE SCHEMA IF NOT EXISTS ${schema()};` before every Operation. If anyone has a better method please let me know

 

Solved Solved
2 2 163
1 ACCEPTED SOLUTION

Try adding

 

 

hasOutput: true

to your config block.

 

 
 

View solution in original post

2 REPLIES 2

Try adding

 

 

hasOutput: true

to your config block.

 

 
 

Omg thank you