MCPcopy Create free account
hub / github.com/dataform-co/dataform / assertTasks

Method assertTasks

cli/api/dbadapters/execution_sql.ts:207–219  ·  view source on GitHub ↗
(
    assertion: dataform.IAssertion,
    projectConfig: dataform.IProjectConfig,
  )

Source from the content-addressed store, hash-verified

205 }
206
207 public assertTasks(
208 assertion: dataform.IAssertion,
209 projectConfig: dataform.IProjectConfig,
210 ): Tasks {
211 const tasks = new Tasks();
212 const target = assertion.target;
213 // Create the view to check syntax of assertion
214 tasks.add(Task.statement(this.createOrReplaceView(target, assertion.query)));
215
216 // Add assertion check
217 tasks.add(Task.assertion(`select sum(1) as row_count from ${this.resolveTarget(target)}`));
218 return tasks;
219 }
220
221 public dropIfExists(target: dataform.ITarget, type: dataform.TableMetadata.Type) {
222 return `drop ${this.tableTypeAsSql(type)} if exists ${this.resolveTarget(target)}`;

Callers 1

createAssertionTasksMethod · 0.95

Calls 5

addMethod · 0.95
createOrReplaceViewMethod · 0.95
resolveTargetMethod · 0.95
statementMethod · 0.80
assertionMethod · 0.80

Tested by

no test coverage detected