GitHub
09/24/2024, 7:30 PMignore glob patterns as standard tap config
Issue created by aaronsteers
Feature scope
Taps (catalog, state, stream maps, etc.)
Description
This proposal would introduce a standard tap config option lik ignored_patterns or ignored_streams, or just ignore, which would accept glob-like input similar to .gitignore. This would operate similar to --exclude in Meltano as the first-order, highest priority (de)selection logic.
While this technically affects "selection" and "deselection", it actually would operate differently from both, and so we should avoid conflating them in discussion.
Like (de)selection logic:
• Ignored streams and properties would not be replicated downstream.
• E.g., whether I "ignore" the user table or deselect it, either way it will not by synced to the target.
• Ignore rules can also be inverted.
• E.g. If I set "ignore": [ "*", "!users", "!customers" ], that is logically equivalent to deselecting all tables except 'users' and 'customers'. (Same as .gitignore convention.)
Unlike (de)selection logic:
• Ignore rules always have higher precedence over selection.
• E.g. If I set "ignore": [ "addresses.*", "*.*email*" ], then I can be 100% sure that no selection logic will later be introduced that pulls in any tables starting with "addresses*" or any columns containing the text "email". (Those physically would not be in the catalog to be selected.)
• Ignore rules apply during discovery.
• E.g. If I set "ignore": [ "information_schema-*" ], then my tap doesn't need to waste time analyzing any tables within information_schema.
A few nice things about accepting patterns and phrasing in the negative:
1. We're not overriding or changing `selection`/`deselection` logic. That logic still functions exactly according to Singer Spec.
2. Catalog output could take into account the ignore logic and save time during discovery - while also reducing the size of the generated catalog artifact.
When to use ignore instead of selection.
| Use Selection | Use Ignore |
| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| When you want to select or deselect specific streams or properties. | When you want to exclude large group of streams or properties from being eligible for selection. (`information_schema-,`.email_address`, broken_table.*) |
| To deselect streams and large data sources you don't need - with the understanding you can add them back easily in the future. | To systematically exclude streams you would never need or want included. |
| To leave record of what is deselected in the catalog. | To suppress the streams or fields from the catalog entirely. |
| To tell the tap to include fields that may not be included by default for that tap. | To tell the tap to ignore fields and tables it otherwise would try to scan. |
Challenges or reasons not to build
The biggest challenge is that there is not an obvious parser or glob pattern for stream and property ignore rules to follow. The easiest path would be to mimic the glob expressions that Meltano uses today for --select and --exclude. But escaping is always something to consider, and there may be other alternatives out there based on jsonpath or similar, which are more standards-based, even if less inherintly readable.
Another challenge is that by removing streams and properties from the catalog entirely, we miss an opportunity to document what exclusions have taken place. We could mitigate this by adding some annotations within to the catalog, such as a top-level "ignored_streams": ["stream-a", "stream-b"] and a stream-level "ignored_properties": ["property-a", "property-b"].
Related to:
• #1234
meltano/sdkGitHub
09/24/2024, 7:30 PMignore glob patterns as standard tap config
Issue closed as completed by stale[bot]
meltano/sdk