Skip to main content

Command Palette

Search for a command to run...

pre_ and post_operations in Dataform

Published
1 min read
pre_ and post_operations in Dataform
C

Senior Data Engineer • Contractor / Freelancer • GCP & AWS Certified

Here's a useful Dataform concept: pre_operations and post_operations. As the name implies, these represent a set of actions that run before and after the main operation (table, view, or SQL operations).

In practice it enables you to cleanly:

➡️ Declare and set a variable

➡️ Clean up before inserting into a table

➡️ Compute a watermark for your incremental model

➡️ Log run metadata after execution

➡️ Perform a maintenance task

What's the most interesting use case you've seen for pre_operations / post_operations (or pre_hook / post_hook if you're on dbt)?