I’m using Transforms to update materialised views using a select from a Postgres function. Not quite what it’s meant to be used for but useful as pgAgent is on its way out.
Problem I have is that I’d like to have multiple transforms per job. Metabase can’t detect any dependencies (fair enough) so the transforms appear to process in alphabetical order (not sure if concurrent).
Is there a way to force the ordering?
If I just rename them to be in the correct order alphabetically, do they run in series or parallel?
Hi @AndrewMBaines ,
Transforms run in parallel unless one reads another transform's output table, so renaming them won't change the order. Here, all three started at the same time:
To run them in sequence, make each transform read the previous one's output table (tested on v0.65.3.7):
To set it up:
- Keep your first transform as it is:
SELECT refresh_view_a() AS done
- In your second transform, add the first transform's output table:
SELECT refresh_view_b() AS done FROM transform_a_output
- In your third transform, add the second transform's output table:
SELECT refresh_view_c() AS done FROM transform_b_output
- Open your job page and check that the transforms are listed in the new order.
Note: refresh_view_a/b/c and transform_a/b_output are example names. Use your own function and output table names.
Docs on dependency order: Transform jobs | Metabase Documentation
Let me know if you have any questions.
Best,
Deekshith
Nice solution, but I had other problems with transforms preventing other schedules running (mostly alerts), so gave up using for any heavy lifting.
We've now moved Postgres to docker instead of Windows. Gives us more toys to play with - cron, DuckDB & Parquet. Great improvements in performance and reliability.