How to - run a list of statements in a single run_query block #1450
bennieregenold7
announced in
Archive
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The dbt run_query macro allows you send multiple SQL statements to your data platform at once. This can help improve speed, and give you more control over operations you'd like to run in a single transaction (checkout the docs linked above for more on transactions).
This is especially useful for instances where you're auto-generating DDL/DML statements, and want to send them all the data platform at once. For example, if you'd like to replicate a sub-set of your production database into dev, you could use the information schema to create DDL statements for those objects. Once you have the list of statements, you can use the code below to execute them in a single block.
Beta Was this translation helpful? Give feedback.
All reactions