Skip to content

Create Prefect Flow For Delta Extract + Pruning Migration Tables #32822

Closed
5 of 5 issues completed
Closed

Description

@Rajandeep98

On migration days, we have been pulling down a subset of the COLIN extract. This already reduces the time required for migration day activities but we would like to reduce this further. We would like to accomplish this by creating a prefect flow to programatically reload only businesses that have changed in the COLIN extract and prune businesses from the migration tables that no longer meet the selection criteria for a given migration batch.

Logic for new flow:

  1. Query COLIN for business identifiers that have changed since last extract was pulled. Ideally we have a table in the COLIN extract that has a timestamp field tracking this.
  2. Run cprd_subset_extract_generator.py with mode = ‘refresh’ for businesses that have changed
  3. Regenerate all views(materialized and standard)
  4. Re-run selection critiera for batch against businesses that have changed
  5. Prune businesses from migration tables(mig_corp_batch, mig_corp_account, colin_tracking, corp_processing) where businesses no longer meet the selection critiera.

Additonal notes:

  • Use USE_MIGRATION_FILTER and related config for determining which business identifiers to use
  • Add logging so we can see which corps changed and also which ones no longer make selection criteria.

Tasks

  • Add a new table to COLIN extract ddl to track when extract was last refreshed
  • Update full COLIN extract script and subset script to update new timestamp field at start of each script before data transfer occurs. Note: it probably makes sense to populate this with the current time minus 2 hours just to be sure we get the correct delta next time we used the timestamp field.
  • Create prefect flow to update COLIN extract for only changed businesses for a given migration batch and to prune migration tables according to selection criteria

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added
    Entities - Data Migration
    on Mar 12, 2026
  2. added theissue type on Mar 12, 2026
  3. self-assigned this
    on Mar 12, 2026
  4. changed the issue type fromtoon Mar 12, 2026
  5. removed theissue type on Mar 13, 2026
  6. changed the title [-]Create Prefect Flow For Delta Extract[/-] [+]Create Prefect Flow For Delta Extract + Pruning Migration Tables[/+] on Mar 18, 2026
  7. argush3 commented on Mar 18, 2026

    @argush3
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Entities - Data Migration

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions