Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

PostgreSQL: FULL OUTER JOIN with partitioned tables

PostgreSQL: FULL OUTER JOIN with partitioned tables
I have 2 datasets (PostgreSQL) to join: "input1", "input2" and the result should be "output".
All datasets are partitioned by date.

How to make a FULL OUTER JOIN and keep the partition?
2 Replies
Community Manager
Community Manager

Here it is (with the partition named "date"):

COALESCE("input1"."date", "input2"."date") as "date",

from "input1"
full outer join "input2"
... and "input1"."date" = "input2"."date"

"input1"."date" = '$DKU_DST_date' or "input2"."date" = '$DKU_DST_date'


Jeremy, Product Manager at Dataiku
Dataiker Alumni
Side note: since it's an OUTER join, SQL keeps all lines from both datasets, even ones that don't match the ON clause, putting NULL values in columns from the other dataset. So adding a condition like "date" = '$DKU_DST_date' in the ON clause does not works, one needs to add it in the WHERE clause.
0 Kudos


Labels (3)
A banner prompting to get Dataiku