Allow both options table-included-patterns and table-excluded-patterns on ch-backup restore command#294
Open
Allow both options table-included-patterns and table-excluded-patterns on ch-backup restore command#294
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoves the mutual-exclusion constraint between the table-included-patterns and table-excluded-patterns options for the ch-backup restore command, allowing them to be used together while keeping other existing option constraints intact. Flow diagram for restore command option constraint validationflowchart TD
Start([Start restore CLI]) --> CheckIncludeExclude
CheckIncludeExclude[Check table_included_patterns and table_excluded_patterns]
CheckIncludeExclude --> BothAllowed[Both options may be provided together]
BothAllowed --> CheckIncludeExcludeDatabases
CheckIncludeExcludeDatabases[Constraint mutually_exclusive table_included_patterns exclude_databases]
CheckIncludeExcludeDatabases -->|Both_set| ErrorIncludeExcludeDatabases[Error invalid combination]
CheckIncludeExcludeDatabases -->|Valid| CheckSchemaOnlyInclude
ErrorIncludeExcludeDatabases --> EndError[Restore command fails]
CheckSchemaOnlyInclude[Constraint mutually_exclusive schema_only table_included_patterns]
CheckSchemaOnlyInclude -->|Both_set| ErrorSchemaOnlyInclude[Error invalid combination]
CheckSchemaOnlyInclude -->|Valid| CheckSchemaOnlyAccess
ErrorSchemaOnlyInclude --> EndError
CheckSchemaOnlyAccess[Constraint mutually_exclusive schema_only access]
CheckSchemaOnlyAccess -->|Both_set| ErrorSchemaOnlyAccess[Error invalid combination]
CheckSchemaOnlyAccess -->|Valid| Proceed[Run restore]
ErrorSchemaOnlyAccess --> EndError
Proceed --> EndSuccess([Restore completed])
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Now that
table_included_patternsandtable_excluded_patternscan be used together, consider making the precedence/interaction explicit in the restore logic (e.g., which filter is applied first) to avoid surprising behavior for edge cases. - If the restore handler assumes that only one of
table_included_patternsortable_excluded_patternsis present, revisit that code path to ensure it behaves correctly when both options are provided simultaneously.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that `table_included_patterns` and `table_excluded_patterns` can be used together, consider making the precedence/interaction explicit in the restore logic (e.g., which filter is applied first) to avoid surprising behavior for edge cases.
- If the restore handler assumes that only one of `table_included_patterns` or `table_excluded_patterns` is present, revisit that code path to ensure it behaves correctly when both options are provided simultaneously.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
aalexfvk
reviewed
Feb 24, 2026
| "Examples: db1.table1 | db1.table2,db2.* | db1.prefix*,db2.*suffix | db1.*", | ||
| ), | ||
| option( | ||
| "--table-excluded-patterns", |
Contributor
There was a problem hiding this comment.
Add pls comment to help about precedence
74ad264 to
962dc08
Compare
962dc08 to
b2a1b77
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ch-backup restore --include-databases db1 --include-table-patterns db1.table* --exclude-table-patterns db1.table_exceptionschema_onlyandtable_included_patternsoptions