Change Sets to enable dry runs and to standarize the file management API #102
Replies: 1 comment 1 reply
-
I really like this idea a whole lot -- being able to create a plan before you execute something is good architectural and general life advice. i don't think I have a ton to say that's insightful and not implementation/details focused, but i'll think out loud anyway!
Would it make sense for the
I would assume just the same rough edges we have now, namely keeping track of when and how to write to a subdirectory vs the source project in the course of a split operation. Not sure where that info would live -- likely not still in the |
Beta Was this translation helpful? Give feedback.
-
Overview
In our current implementation of dbt-meshify, we've tightly coupled our logical operations (adding a group, adding a contract, etc.) together with our file loading tooling (
DbtFileManager
) and our file editing tooling (DbtMeshFileEditor
). This approach works, but there are a few distinct drawbacks:dbt-meshify
will be doing prior to executing the changes (no dry runs).To mitigate these issues, I propose we create a concept of a
Change
, which tracks operations that need to be performed on a given resource. Each logical operation will identify a set ofChanges
that need to be made (e.g. creating aGroup
and updating aModel
to be a member of the newGroup
). These sets ofChanges
will then be merged together and processed as a single unit following a consistent API.Example
For example, suppose we're creating a new
revenue
group, and updating theorders
model to be a member of that group. For this, theResourceGrouper
would yield the following changes:Within the
cli
method, we could then receive the change set from each downstream CLI operation and pass the change set to a change set processor (ChangeSetProcessor
😉) which merges like operations (two + updates to the same file/model/etc), and passes the operation to an appropriate file handling class (ResourcePropertiesEditor
,ProjectEditor
,SQLEditor
,PythonEditor
), each of which following a standard Protocol (create()
,update()
,move()
).We can also update the
cli
method to accept a--dry-run
option, which prints a pretty set of changes to be applied and returns prior to accepting modifications. If we wanted to be really mad lads, we could also accept change sets as input, thereby allowing for a code review of what dbt-meshify will be executing.This all should sound familiar to folks familiar with terraform >.>
Benefits
Drawbacks
Open questions
ChangeSetProcessor
perform in our initial implementation?Beta Was this translation helpful? Give feedback.
All reactions