<#2423 Ability to dynamically calculate target tab...
# meltano-repo-activity
g
#2423 Ability to dynamically calculate target table name and/or deprecate previous versions of a table Issue created by MeltyBot Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/2468 Originally created by @aaronsteers on 2020-12-01 233529 --- Problem to solve This is not a critical issue or blocker, but it's been coming up a bunch lately in my own organization while using Tapdance. We want to keep target database permissions at a minimum and have everything automated. But there's not a very clean way to do "fresh starts" or "full backfill" on a given table. Triggering a full backfill is tricky in today's singer ecosystem. There are two steps which need to be performed in the case of either (a) requiring a full backfill or (b) creating a fresh start due to table definition changes. Singer does a create job of auto-adding missing columns - but (for good reason) there is an aversion in the platform to destructive updates. This proposal would outline two paths to automating "major version" increments which require starting a new fresh version of the target table. Target audience 1. As a data engineer, I don't want to have to perform a precise and synchronized manual operations in order to get a fresh start on a table. 2. As a data team lead, I don't want to have to closely supervise the manual operations required for a full backfill or "fresh start" on an existing table. I want the above to be possible and also to have confidence that no data loss will occur (unless explicitly performed or requested). Further details A typical target schema today might look like this:
Copy code
raw_db
 |- raw_salesforce
     |- account
     |- opportunity
     |- user
After adding version numbers (starting with "2" to avoid confusion), the target schema after updating versions and rerunning the pipeline might look like:
Copy code
raw_db
 |- raw_salesforce
     |- account          (prev version)
     |- account__v2      (new version)
     |- opportunity      (prev version)
     |- opportunity__v2  (new version)
     |- user             (prev version)
     |- user__v2         (new version)
Assuming this is consumed by a tool like dbt, the downstream transforms now automatically can union the data together and migrate safely to the new version. Optionally, an administrator can later drop the older table versions for data sensitivity reasons or just to reduce confusion. Proposal In outline: • Meltano would add a 'major version number' which can be incremented per table. The version number would be (optionally) configured per-table in
meltano.yml
. A command line interface could auto-bump the version number on a specific table, or on all tables in a given source. • The version number (if set) would be automatically concatenated as a suffix in the target table name, and it could also be concatenated into the state file path. • By optionally and simultaneously changing the state file path (or the bookmark within the state file), we can simultaneously break the connection to the prior version's bookmark - which then triggers a full table reload on next execution. What does success look like, and how can we measure that? If usage statistics are available, a metric of feature usage would be a good indicator of whether the feature is valuable to meltano users. Otherwise, it would be measurable in increased adoption of the tool and/or higher product satisfaction metrics on topics such as maintainability. Regression test (Ensure the feature doesn't cause any regressions) • Write adequate test cases and submit test results • Test results should be reviewed by a person from the team Links / references Please note that this was taken from GitLab, to be changed accordingly meltano/meltano