Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated "delete+insert" incremental strategy macros #137

Merged
merged 2 commits into from
Mar 19, 2024
Merged

Conversation

aosingh
Copy link
Member

@aosingh aosingh commented Mar 18, 2024

The delete+insert incremental strategy does the following in each incremental run

  1. Select new records using the WHERE clause
create global temporary table o$pt_us_product_delete_insert120225489099
on commit preserve rows
as
select {{ model_sql }}
AND times.calendar_month_desc > (SELECT MAX(calendar_month_desc) FROM dbt_test.us_product_delete_insert)
  1. Delete existing records from destination table based on matching unique keys
DELETE FROM dbt_test.us_product_delete_insert DBT_INTERNAL_DEST
  WHERE ( DBT_INTERNAL_DEST.PROD_NAME ,  DBT_INTERNAL_DEST.GROUP_ID)
  IN    ( SELECT  DBT_INTERNAL_SOURCE.PROD_NAME , DBT_INTERNAL_SOURCE.GROUP_ID 
          FROM o$pt_us_product_delete_insert120225489099 DBT_INTERNAL_SOURCE)
  1. Insert newly selected records
insert  /*+parallel(4)*/  into  dbt_test.us_product_delete_insert (PROD_NAME, CHANNEL_DESC, CALENDAR_MONTH_DESC, GROUP_ID, SALES$, DEFAULT_RANK, CUSTOM_RANK)
(select PROD_NAME, CHANNEL_DESC, CALENDAR_MONTH_DESC, GROUP_ID, SALES$, DEFAULT_RANK, CUSTOM_RANK
 from o$pt_us_product_delete_insert120225489099)

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 18, 2024
@aosingh aosingh merged commit b616c26 into main Mar 19, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants