Skip to content

[#1] feat: add --cascade/--no-cascade flag to sync import-assets#375

Merged
richardfogaca merged 11 commits intomainfrom
feature/no-cascade-import
Feb 27, 2026
Merged

[#1] feat: add --cascade/--no-cascade flag to sync import-assets#375
richardfogaca merged 11 commits intomainfrom
feature/no-cascade-import

Conversation

@richardfogaca
Copy link
Contributor

@richardfogaca richardfogaca commented Feb 18, 2026

What Changed

Added --cascade/--no-cascade (default: --cascade) to preset-cli superset import-assets / sync native.

Behavior with --no-cascade:

  • Forces split-mode import and avoids overwriting existing dependencies
  • --overwrite applies only to the selected primary asset type
  • No-cascade update semantics per asset type:
    • --asset-type dashboard — updates the dashboard without overwriting existing dependent charts/datasets
    • --asset-type chart — updates the chart without overwriting the existing dependent dataset/database
    • --asset-type dataset — updates the dataset without overwriting the existing dependent database
    • --asset-type database — updates the database only
  • Existing database connections are not overwritten unless importing database assets directly

Also accepts .zip bundle input in addition to directory input, with path-safety checks during extraction.

Fixes clean_logs() to use unlink(missing_ok=True) so a missing progress log does not raise during cleanup.

Test plan

  • pytest tests/cli/superset/sync/native/command_test.py — 100 tests pass
  • preset superset sync native --no-cascade <path> — confirm existing dependencies are left untouched
  • preset superset sync native --cascade <path> (default) — confirm behavior is unchanged
  • Pass a .zip bundle as input — confirm it is extracted and imported correctly

Introduces a --cascade/--no-cascade option (default: --cascade) to the
sync native import command. When --no-cascade is used, existing
dependency assets (databases, datasets, charts) are not overwritten
during import—only the primary assets being imported are updated.

Also fixes clean_logs() to use unlink(missing_ok=True) so that a
missing progress log file does not raise an error during cleanup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@richardfogaca richardfogaca changed the title feat: add --cascade/--no-cascade flag to sync import-assets #1 - feat: add --cascade/--no-cascade flag to sync import-assets Feb 19, 2026
@richardfogaca richardfogaca changed the title #1 - feat: add --cascade/--no-cascade flag to sync import-assets [#1] feat: add --cascade/--no-cascade flag to sync import-assets Feb 19, 2026
@richardfogaca richardfogaca requested a review from EnxDev February 25, 2026 11:52
Copy link
Contributor

@EnxDev EnxDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to split the command.py file and extract the no-cascade logic into a dedicated module?

Copy link
Contributor

@EnxDev EnxDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@richardfogaca richardfogaca merged commit 59756b8 into main Feb 27, 2026
6 checks passed
@richardfogaca richardfogaca deleted the feature/no-cascade-import branch February 27, 2026 15:11
@richardfogaca richardfogaca restored the feature/no-cascade-import branch February 27, 2026 15:11
@richardfogaca richardfogaca deleted the feature/no-cascade-import branch February 27, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants