cdf modules lists the modules in your project, pulls CDF changes back into those modules, adds deployment packs, and upgrades project files when you install a new Cognite Toolkit version.
List modules
Use this command to see which modules are in themodules/ directory and whether the Cognite Toolkit found any issues. Data engineers and Cognite Toolkit administrators both run it.
cdf modules list prints one row per module:
Module status
Pull modules
Usecdf modules pull to copy resources from your CDF project back into modules/. The command keeps the module structure, variables, and comments. It only updates resources that are already in a module. It is the reverse of cdf build and cdf deploy. Pull after you edit a resource in the CDF UI and want that change in the module.
Before you pull, read Building configurations and Deploying configurations. Keep a .env file for your CDF project.
1
Create a bare-bones transformation
Build and deploy a transformation to CDF. Create this YAML file:and place it in Build and deploy the transformation:and
Bare-bones transformation
modules/my_module/transformations/my.Transformation.yaml.2
Edit the transformation in CDF
Open the transformation in CDF and add this
query:3
Pull the transformation into your local module
Pull the transformation from CDF into the local module:The command writes the CDF change into the local module and keeps the module structure, variables, and comments. The summary reports one changed transformation.
4
Inspect result
Open the transformation YAML:The
Pulled transformation
query you added in CDF is now in the local module. The variable, the comment, and the rest of the file are unchanged.If you use git or another version control system, you should now commit the changes to your local module.Add deployment packs
Data engineers rarely write every resource from scratch. Start from a deployment pack: a templatized module you adapt for your project. See Deployment packs.1
Set the deployment pack source
Put This is the default source of deployment packs. Cognite develops and maintains that library.
cdf.toml in the directory where you run cdf. The file includes the source of the deployment packs.Example cdf.toml file
2
Add a deployment pack
To add a deployment pack, run:If you do not have a
modules/ directory, run cdf modules init instead. cdf init runs that command when you select Modules.The wizard asks you to select and install a deployment pack:Select a deployment pack
3
Inspect the results
After the command has completed, you can inspect the results. Your Each module has a The variables
modules/ directory should now contain
the new module you added:module.toml file that describes the source of the module. Keep this file in the module
directory. The README.md file contains documentation from the author of the deployment pack.Then inspect config.dev.yaml. If the deployment pack defines variables, config.dev.yaml is updated:Example config.dev.yaml file
modules.common.cdf_ingestion.workflow and modules.common.cdf_ingestion.dataset are now
in config.dev.yaml.Upgrade modules
Cognite Toolkit administrators runcdf modules upgrade after installing a new CLI version. The command updates
cdf.toml and CI/CD pipeline files so they match that version.
--verbose prints each change. A version change updates the Cognite Toolkit version in cdf.toml:
cdf.toml
cognite/toolkit:0.9.23 to cognite/toolkit:0.9.24. Review the diff before you commit it.
When a resource format has a breaking change,
cdf modules upgrade tries to rewrite the YAML files to the new format. Review that diff before you commit it.