Using partitioning in ETL or Workbench

Jbrorby
Jbrorby Contributor
edited March 2023 in Workbench

Good afternoon.

Typically, to not do full replaces of data pulls into Domo from our databases, we have used recursive dataflows with ETL. I am trying to think of a way of accomplishing this using the partitioning features in ETL and/or workbench to avoid the ETL still having to process the whole set of updated+historical.

I either can't wrap my head around it, or just don't have a strong enough grasp on the partitioning features, or I'm barking up the wrong function-tree.

I have attached a very small sample of what one of our raw jobs might look like when it gets into Domo and am wondering if anyone thinks partitioning is a good use case for this.

Each separate color column header represents a different table in the SQL Server database we're pulling into workbench from. Each table is connected with the column "donation_id". Each row represents a single, unique donation for which we would only ever want 1 row of in the ETL output.

Other than "donation_id", any of the columns can be modified at any time (the day after a donation or 10 years after a donation). When 1 table is modified in the database, it does not prompt the other tables to be modified.

Example, in the screen shot, the collection_date is 1/1/2020. If any one of these columns changed on 3/30/2023, we would want to bring in that new row, and eliminate the existing row.

Best Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    Partitions are used to replace a group of records typically. If you have some records being replaced for a date then pull in all records for that date and use the date as your partition key. This will replace all records with that date.

    Alternatively if records aren’t being deleted you can utilize UPSERT in workbench to update just that single record based on the id

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • AnwarBham
    AnwarBham Contributor
    Answer ✓

    id be very carefull with write backs we found it was not copying rows where the keys were duplicates.

    column1 and column2 are the key identifier columns, column 3 new values to bring

    ie old dataset

    column 1

    column2

    column3

    Date1

    AAA

    23

    Date2

    BBB

    23

    Date1

    AAAC

    24

    new dataset

    column 1

    column2

    column3

    Date1

    AAA

    27

    Date2

    BBB

    23

    Date1

    AAA

    24

    Date2

    BBB

    23

    from the new dataset 1st column whould not copy over because partitiuon thought it already existed.

    Maybe more documentation is required

Answers

  • GrantSmith
    GrantSmith Coach
    Answer ✓

    Partitions are used to replace a group of records typically. If you have some records being replaced for a date then pull in all records for that date and use the date as your partition key. This will replace all records with that date.

    Alternatively if records aren’t being deleted you can utilize UPSERT in workbench to update just that single record based on the id

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • AnwarBham
    AnwarBham Contributor
    Answer ✓

    id be very carefull with write backs we found it was not copying rows where the keys were duplicates.

    column1 and column2 are the key identifier columns, column 3 new values to bring

    ie old dataset

    column 1

    column2

    column3

    Date1

    AAA

    23

    Date2

    BBB

    23

    Date1

    AAAC

    24

    new dataset

    column 1

    column2

    column3

    Date1

    AAA

    27

    Date2

    BBB

    23

    Date1

    AAA

    24

    Date2

    BBB

    23

    from the new dataset 1st column whould not copy over because partitiuon thought it already existed.

    Maybe more documentation is required

  • How do you use upsert in Workbench? I'm using the latest version and I do not see any way to set unique keys, upsert or anything that is mentioned in these posts.

    Looking at the schema, I only have the following:
    Source Column
    Destination Column
    Data Type
    Include
    Lock Data Type
    Protect

    Right clicking the column does not give me any options, it does nothing.

    Looking at the JSON definition of the job, I do see where it has attributes assigned, but have no way to modify these in the GUI.
    Example: "UpsertKey":false
    I would like to be able to set this to "true".

    I attempting to do an upsert, but I am getting duplicate rows.

  • Jbrorby
    Jbrorby Contributor

    @FreddieG You need to set the update method to append, then in the schema, there should be an Upsert Key column. This was not appearing for me originally so I had to contact Domo support and they got it added pretty quickly. I can't remember if it is still in beta or not