diff --git a/0.5/commands/index.html b/0.5/commands/index.html index 30df624..ad730e9 100644 --- a/0.5/commands/index.html +++ b/0.5/commands/index.html @@ -481,9 +481,11 @@
Create a group and add selected resources to the group.
@@ -546,9 +548,11 @@dbt-meshify
is a CLI tool that automates the creation of model governance and cross-project lineage features introduced in dbt-core v1.5 and v1.6. This package will leverage your dbt project metadata to create and/or edit the files in your project to properly configure the models in your project with these features.
These features include:
access
level of models within groupsref
.This package leverages the dbt-core Python API to allow users to use standard dbt selection syntax for each of the commands in this package (unless otherwise noted). See details on each of the specific commands available on the commands page.
"},{"location":"#getting-started","title":"Getting Started","text":"This package helps automate the code development required for adding the model governance and cross-project lineage features mentioned above.
The first question to ask yourself is \"which of these features do I want to add to my project\"? Do you want to add contracts, create a new group, split your monolithic dbt project in two? Your answer to this question will establish which dbt-meshify
command is right for you!
This package consists of component and global commands - so you can decide how to best break apart your work.
The component commands allow you to do a single step at a time and begin with dbt-meshify operation
. For example, if you wanted to add a new version to a model, you would run something like dbt-meshify operation add-version --select fct_orders
. This command would:
fct_orders
and that's it!
The global commands combine multiple component commands to complete a larger set of work and begin with dbt-meshify
. For example, if you wanted to define a group for a subset of your models, you would run something like dbt-meshify group finance --owner-name \"Monopoly Man\" --select +tag:finance
. This command would:
access
to protected for all \"leaf\" models (models with no downstream dependencies) and models with cross-group dependenciesall at once!
The next question to ask yourself is \"which of my models do I want to add these features to?\". This informs the selection syntax you provide to the dbt-meshify
command of choice. dbt-meshify
uses the same selection syntax as dbt
, so you can use the --select
, --exclude
and --selector
flags to select resources based on model names, tags, and so on!
Once you've decided:
you're ready to use dbt-meshify
!
For further information, check out the available commands or read through some examples.
"},{"location":"#what-dbt-meshify-does-not-handle","title":"What dbt-meshify does not handle","text":"There are a handful of known edge cases that this package does not automatically handle. In these cases, we recommend doing a manual check to make sure you've handled these appropriately:
edge case manual checkdbt-meshify split
copies over the entire contents of the packages.yml
file from the original project to the new subproject remove unnecessary packages from each project dbt-meshify split
makes a copy of all necessary macros from the original project to the new subproject consider creating a private \"macros only\" project to install as a package into all of your other projects, instead of maintaining duplicate copies of shared macros"},{"location":"commands/","title":"dbt-meshify Commands","text":""},{"location":"commands/#dbt-meshify","title":"dbt-meshify","text":"Usage:
dbt-meshify [OPTIONS] COMMAND [ARGS]...\n
Options:
--dry-run\n --debug\n --version Show version information and exit\n --help Show this message and exit.\n
Subcommands
Connects multiple dbt projects together by adding all necessary dbt Mesh constructs
Usage:
dbt-meshify connect [OPTIONS]\n
Options:
--project-paths TUPLE The paths to the set of dbt projects to\n connect. Must supply 2+ paths.\n --projects-dir PATH The path to a directory containing multiple\n dbt projects. Directory must contain 2+\n projects.\n -e, --exclude-projects TUPLE The set of dbt projects to exclude from the\n operation when using the --projects-dir\n option.\n -r, --read-catalog Skips the dbt docs generate step and reads the\n local catalog.json file.\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-group","title":"dbt-meshify group","text":"Creates a new dbt group based on the selection syntax Detects the edges of the group, makes their access protected, and adds contracts to them
Usage:
dbt-meshify group [OPTIONS] NAME\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources\n to exclude in the operation\n --group-yml-path PATH An optional path to store the new group YAML\n definition.\n --owner-email TEXT The group Owner's email address.\n --owner-name TEXT The group Owner's name.\n --owner-properties TEXT Additional properties to assign to a group Owner.\n --project-path PATH The path to the dbt project to operate on. Defaults\n to the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the\n local catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources\n to include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation","title":"dbt-meshify operation","text":"Set of subcommands for performing mesh operations on dbt projects
Usage:
dbt-meshify operation [OPTIONS] COMMAND [ARGS]...\n
Options:
--help Show this message and exit.\n
Subcommands
Adds a contract to all selected models.
Usage:
dbt-meshify operation add-contract [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation-add-version","title":"dbt-meshify operation add-version","text":"Adds model version boilerplate for all selected models.
Usage:
dbt-meshify operation add-version [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --defined-in TEXT\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation-bump-version","title":"dbt-meshify operation bump-version","text":"Create new model versions for all selected models.
Usage:
dbt-meshify operation bump-version [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n -l, --latest Makes the newest version the latest version when\n incrementing model versions\n --defined-in TEXT\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation-create-group","title":"dbt-meshify operation create-group","text":"Create a group and add selected resources to the group.
Usage:
dbt-meshify operation create-group [OPTIONS] NAME\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources\n to exclude in the operation\n --group-yml-path PATH An optional path to store the new group YAML\n definition.\n --owner-email TEXT The group Owner's email address.\n --owner-name TEXT The group Owner's name.\n --owner-properties TEXT Additional properties to assign to a group Owner.\n --project-path PATH The path to the dbt project to operate on. Defaults\n to the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the\n local catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources\n to include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-split","title":"dbt-meshify split","text":"Splits out a new subproject from a dbt project by adding all necessary dbt Mesh constructs to the resources based on the selected resources.
Usage:
dbt-meshify split [OPTIONS] PROJECT_NAME\n
Options:
--create-path PATH The path to create the new dbt project. Defaults to the\n name argument supplied.\n -e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-version","title":"dbt-meshify version","text":"Increment the models to the next version, and create in the initial version if it has not yet been defined.
Usage:
dbt-meshify version [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n -l, --latest Makes the newest version the latest version when\n incrementing model versions\n --defined-in TEXT\n --help Show this message and exit.\n
"},{"location":"examples/","title":"Examples","text":"For consistency and clarity of the following examples, we're going to use a simplified dbt project. In practice, the model governance and cross-project lineage features describe are most beneficial for large dbt projects that are struggling to scale.
We will give a basic example for each command, but to see the full list of additional flags you can add to a given command, check out the commands page.
Note
One helpful flag that you can add to all of the commands is --read-catalog
, which will skip the dbt docs generate
step and instead read the local catalog.json
file - this will speed up the time it takes to run the dbt-meshify
commands but relies on your local catalog.json
file being up-to-date. Alternatively, you can configure this via the DBT_MESHIFY_READ_CATALOG
environment variable.
Let's imagine a dbt project with the following models:
You can checkout the source code for this example here.
"},{"location":"examples/#component-commands","title":"Component commands","text":""},{"location":"examples/#create-a-new-group","title":"Create a new group","text":"Let's say you want to create a new group for your sales analytics models.
You can run the following command:
dbt-meshify operation create-group sales_analytics --owner-name Ralphie --select +int_sales__unioned +int_returns__unioned transactions\n
This will create a new group named \"sales_analytics\" with the owner \"Ralphie\" and add all selected models to that group with the appropriate access
configuration:
create a new group definition in a _groups.yml
file:
add all selected models to that group with the appropriate access
config
access: private
access: protected
Let's say you want to add a new version to the customers model, which is currently un-versioned. Versions can provide a smoother upgrade pathway when introducing breaking changes to models that have downstream dependencies.
You can run the following command:
dbt-meshify version --select customers\n
This will add a version to the customers
model for your current version, and will add a new version for breaking change you wish to implement:
customers.sql
file will be renamed to customers_v1.sql
customers_v2.sql
file will be created based on customers_v1.sql
yml
file) Let's say you want to add a new contract to the stores
model, which is currently un-contracted.
You can run the following command:
dbt-meshify operation add-contract --select stores\n
This will add an enforced contract to the stores
model:
contract
config and set enforced: true
name
and data_type
if not already defined Let's say you want to group together your sales analytics models - create a new group and add contracts to appropriate models simultaneously.
You can run the following command:
dbt-meshify group sales_analytics --owner-name Ralphie --select +int_sales__unioned +int_returns__unioned transactions\n
This will create a new group named \"sales_analytics\" with the owner \"Ralphie\", add all selected models to that group with the appropriate access
configuration, _and add contracts to the models at the boundary between this group and the rest of the project__:
_groups.yml
file access
configaccess: private
access: protected
protected
models:contract
config and set enforced: true
name
and data_type
if not already defined Let's say you want to split our your sales analytics models into a new subproject.
You can run the following command:
dbt-meshify split sales_analytics --select +int_sales__unioned +int_returns__unioned transactions\n
This will create a new subproject that contains the selected sales analytics models, configure the \"edge\" models to be public
and contracted, and replace all dependencies in the downstream project on the upstreams's models with cross-project ref
s:
create a new subproject that contains the selected sales analytics models
add a dependencies.yml
to the downstream project (in our case, our new subproject is downstream of the original project because the transactions
model depends on some of the models that remain in the original project - stores
and customers
)
access: public
to all \"leaf\" models (models with no downstream dependencies) and models in the upstream project that are referenced by models in the downstream project public
models:contract
config and set enforced: true
name
and data_type
if not already defined ref
By default, the new subproject will be created in the current directory; however, you can use the --create-path
flag to create it in any directory you like.
Let's look at a slightly modified version of the example we've been working with. Instead of a single dbt project, let's imagine you're starting with two separate dbt projects connected via the \"source hack\":
We call this type of multi-project configuration the \"source hack\" because there are models generated by project A (stores
and customers
) that are defined as sources in project B.
Let's say we want to connect these two projects using model governance best practices and cross project ref
s.
You can run the following command:
dbt-meshify connect --project-paths path/to/project_a path/to/project_b\n
This will make the upstream project a dependency for the downstream project, configure the \"edge\" models to be public
and contracted, and replace all dependencies in the downstream project on the upstreams's models with cross-project ref
s:
dependencies.yml
to the downstream project (in our case, project B is downstream of project A because the transactions
model depends on some of the models that are generated by project A - stores
and customers
) access: public
to all models in the upstream project that are referenced by models in the downstream project public
models:contract
config and set enforced: true
name
and data_type
if not already defined ref
dbt-meshify
is a CLI tool that automates the creation of model governance and cross-project lineage features introduced in dbt-core v1.5 and v1.6. This package will leverage your dbt project metadata to create and/or edit the files in your project to properly configure the models in your project with these features.
These features include:
access
level of models within groupsref
.This package leverages the dbt-core Python API to allow users to use standard dbt selection syntax for each of the commands in this package (unless otherwise noted). See details on each of the specific commands available on the commands page.
"},{"location":"#getting-started","title":"Getting Started","text":"This package helps automate the code development required for adding the model governance and cross-project lineage features mentioned above.
The first question to ask yourself is \"which of these features do I want to add to my project\"? Do you want to add contracts, create a new group, split your monolithic dbt project in two? Your answer to this question will establish which dbt-meshify
command is right for you!
This package consists of component and global commands - so you can decide how to best break apart your work.
The component commands allow you to do a single step at a time and begin with dbt-meshify operation
. For example, if you wanted to add a new version to a model, you would run something like dbt-meshify operation add-version --select fct_orders
. This command would:
fct_orders
and that's it!
The global commands combine multiple component commands to complete a larger set of work and begin with dbt-meshify
. For example, if you wanted to define a group for a subset of your models, you would run something like dbt-meshify group finance --owner-name \"Monopoly Man\" --select +tag:finance
. This command would:
access
to protected for all \"leaf\" models (models with no downstream dependencies) and models with cross-group dependenciesall at once!
The next question to ask yourself is \"which of my models do I want to add these features to?\". This informs the selection syntax you provide to the dbt-meshify
command of choice. dbt-meshify
uses the same selection syntax as dbt
, so you can use the --select
, --exclude
and --selector
flags to select resources based on model names, tags, and so on!
Once you've decided:
you're ready to use dbt-meshify
!
For further information, check out the available commands or read through some examples.
"},{"location":"#what-dbt-meshify-does-not-handle","title":"What dbt-meshify does not handle","text":"There are a handful of known edge cases that this package does not automatically handle. In these cases, we recommend doing a manual check to make sure you've handled these appropriately:
edge case manual checkdbt-meshify split
copies over the entire contents of the packages.yml
file from the original project to the new subproject remove unnecessary packages from each project dbt-meshify split
makes a copy of all necessary macros from the original project to the new subproject consider creating a private \"macros only\" project to install as a package into all of your other projects, instead of maintaining duplicate copies of shared macros"},{"location":"commands/","title":"dbt-meshify Commands","text":""},{"location":"commands/#dbt-meshify","title":"dbt-meshify","text":"Usage:
dbt-meshify [OPTIONS] COMMAND [ARGS]...\n
Options:
--dry-run\n --debug\n --version Show version information and exit\n --help Show this message and exit.\n
Subcommands
Connects multiple dbt projects together by adding all necessary dbt Mesh constructs
Usage:
dbt-meshify connect [OPTIONS]\n
Options:
--project-paths TUPLE The paths to the set of dbt projects to\n connect. Must supply 2+ paths.\n --projects-dir PATH The path to a directory containing multiple\n dbt projects. Directory must contain 2+\n projects.\n -e, --exclude-projects TUPLE The set of dbt projects to exclude from the\n operation when using the --projects-dir\n option.\n -r, --read-catalog Skips the dbt docs generate step and reads the\n local catalog.json file.\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-group","title":"dbt-meshify group","text":"Creates a new dbt group based on the selection syntax Detects the edges of the group, makes their access protected, and adds contracts to them
Usage:
dbt-meshify group [OPTIONS] NAME\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources\n to exclude in the operation\n --group-yml-path PATH An optional path to store the new group YAML\n definition.\n --owner-email TEXT The group Owner's email address.\n --owner-name TEXT The group Owner's name.\n --owner-properties TEXT Additional properties to assign to a group Owner.\n --project-path PATH The path to the dbt project to operate on. Defaults\n to the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the\n local catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources\n to include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation","title":"dbt-meshify operation","text":"Set of subcommands for performing mesh operations on dbt projects
Usage:
dbt-meshify operation [OPTIONS] COMMAND [ARGS]...\n
Options:
--help Show this message and exit.\n
Subcommands
Adds a contract to all selected models.
Usage:
dbt-meshify operation add-contract [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation-add-version","title":"dbt-meshify operation add-version","text":"Adds model version boilerplate for all selected models.
Usage:
dbt-meshify operation add-version [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --defined-in TEXT\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation-bump-version","title":"dbt-meshify operation bump-version","text":"Create new model versions for all selected models.
Usage:
dbt-meshify operation bump-version [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n -l, --latest Makes the newest version the latest version when\n creating model versions\n --increment, --i Increments the latest_version setting by 1 when\n creating model versions\n --defined-in TEXT\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-operation-create-group","title":"dbt-meshify operation create-group","text":"Create a group and add selected resources to the group.
Usage:
dbt-meshify operation create-group [OPTIONS] NAME\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources\n to exclude in the operation\n --group-yml-path PATH An optional path to store the new group YAML\n definition.\n --owner-email TEXT The group Owner's email address.\n --owner-name TEXT The group Owner's name.\n --owner-properties TEXT Additional properties to assign to a group Owner.\n --project-path PATH The path to the dbt project to operate on. Defaults\n to the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the\n local catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources\n to include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-split","title":"dbt-meshify split","text":"Splits out a new subproject from a dbt project by adding all necessary dbt Mesh constructs to the resources based on the selected resources.
Usage:
dbt-meshify split [OPTIONS] PROJECT_NAME\n
Options:
--create-path PATH The path to create the new dbt project. Defaults to the\n name argument supplied.\n -e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n --help Show this message and exit.\n
"},{"location":"commands/#dbt-meshify-version","title":"dbt-meshify version","text":"Increment the models to the next version, and create in the initial version if it has not yet been defined.
Usage:
dbt-meshify version [OPTIONS]\n
Options:
-e, --exclude TUPLE The dbt selection syntax specifying the resources to\n exclude in the operation\n --project-path PATH The path to the dbt project to operate on. Defaults to\n the current directory.\n -r, --read-catalog Skips the dbt docs generate step and reads the local\n catalog.json file.\n -s, --select TUPLE The dbt selection syntax specifying the resources to\n include in the operation\n --selector TUPLE The name(s) of the YML selector specifying the\n resources to include in the operation\n -l, --latest Makes the newest version the latest version when\n creating model versions\n --increment, --i Increments the latest_version setting by 1 when\n creating model versions\n --defined-in TEXT\n --help Show this message and exit.\n
"},{"location":"examples/","title":"Examples","text":"For consistency and clarity of the following examples, we're going to use a simplified dbt project. In practice, the model governance and cross-project lineage features describe are most beneficial for large dbt projects that are struggling to scale.
We will give a basic example for each command, but to see the full list of additional flags you can add to a given command, check out the commands page.
Note
One helpful flag that you can add to all of the commands is --read-catalog
, which will skip the dbt docs generate
step and instead read the local catalog.json
file - this will speed up the time it takes to run the dbt-meshify
commands but relies on your local catalog.json
file being up-to-date. Alternatively, you can configure this via the DBT_MESHIFY_READ_CATALOG
environment variable.
Let's imagine a dbt project with the following models:
You can checkout the source code for this example here.
"},{"location":"examples/#component-commands","title":"Component commands","text":""},{"location":"examples/#create-a-new-group","title":"Create a new group","text":"Let's say you want to create a new group for your sales analytics models.
You can run the following command:
dbt-meshify operation create-group sales_analytics --owner-name Ralphie --select +int_sales__unioned +int_returns__unioned transactions\n
This will create a new group named \"sales_analytics\" with the owner \"Ralphie\" and add all selected models to that group with the appropriate access
configuration:
create a new group definition in a _groups.yml
file:
add all selected models to that group with the appropriate access
config
access: private
access: protected
Let's say you want to add a new version to the customers model, which is currently un-versioned. Versions can provide a smoother upgrade pathway when introducing breaking changes to models that have downstream dependencies.
You can run the following command:
dbt-meshify version --select customers\n
This will add a version to the customers
model for your current version, and will add a new version for breaking change you wish to implement:
customers.sql
file will be renamed to customers_v1.sql
customers_v2.sql
file will be created based on customers_v1.sql
yml
file) Let's say you want to add a new contract to the stores
model, which is currently un-contracted.
You can run the following command:
dbt-meshify operation add-contract --select stores\n
This will add an enforced contract to the stores
model:
contract
config and set enforced: true
name
and data_type
if not already defined Let's say you want to group together your sales analytics models - create a new group and add contracts to appropriate models simultaneously.
You can run the following command:
dbt-meshify group sales_analytics --owner-name Ralphie --select +int_sales__unioned +int_returns__unioned transactions\n
This will create a new group named \"sales_analytics\" with the owner \"Ralphie\", add all selected models to that group with the appropriate access
configuration, _and add contracts to the models at the boundary between this group and the rest of the project__:
_groups.yml
file access
configaccess: private
access: protected
protected
models:contract
config and set enforced: true
name
and data_type
if not already defined Let's say you want to split our your sales analytics models into a new subproject.
You can run the following command:
dbt-meshify split sales_analytics --select +int_sales__unioned +int_returns__unioned transactions\n
This will create a new subproject that contains the selected sales analytics models, configure the \"edge\" models to be public
and contracted, and replace all dependencies in the downstream project on the upstreams's models with cross-project ref
s:
create a new subproject that contains the selected sales analytics models
add a dependencies.yml
to the downstream project (in our case, our new subproject is downstream of the original project because the transactions
model depends on some of the models that remain in the original project - stores
and customers
)
access: public
to all \"leaf\" models (models with no downstream dependencies) and models in the upstream project that are referenced by models in the downstream project public
models:contract
config and set enforced: true
name
and data_type
if not already defined ref
By default, the new subproject will be created in the current directory; however, you can use the --create-path
flag to create it in any directory you like.
Let's look at a slightly modified version of the example we've been working with. Instead of a single dbt project, let's imagine you're starting with two separate dbt projects connected via the \"source hack\":
We call this type of multi-project configuration the \"source hack\" because there are models generated by project A (stores
and customers
) that are defined as sources in project B.
Let's say we want to connect these two projects using model governance best practices and cross project ref
s.
You can run the following command:
dbt-meshify connect --project-paths path/to/project_a path/to/project_b\n
This will make the upstream project a dependency for the downstream project, configure the \"edge\" models to be public
and contracted, and replace all dependencies in the downstream project on the upstreams's models with cross-project ref
s:
dependencies.yml
to the downstream project (in our case, project B is downstream of project A because the transactions
model depends on some of the models that are generated by project A - stores
and customers
) access: public
to all models in the upstream project that are referenced by models in the downstream project public
models:contract
config and set enforced: true
name
and data_type
if not already defined ref