Add your description here
Actively maintained. Last release 3 months ago, commits in 14 of the last 26 weeks. A safe choice.
pip install dbt-fusion-package-toolsPackage Management
This directory contains code used by the packages option in the CLI that upgrades packages in a project to a Fusion-compatible version. The code is centered on four classes:
- DbtPackageFile: represents a file (currently packages.yml or dependencies.yml) that contains package dependencies for a project
- DbtPackage: represents a package that is installed as a dependency for the project
- DbtPackageVersion: represents a specific version of a package
- DbtPackageTextFile: contains the raw lines of text from package dependency files. This is used when upgrading packages so we can replace just the version strings within a file without affecting the rest of the file layout (such as comments).
How the CLI works
The packages command calls the upgrade_packages function in main.py. This then calls:
generate_package_dependencies: extracts dependencies from project's packages.yml/dependencies.yml file and identifies installed package versions indbt_packages- Returns
DbtPackageFileif a packages.yml/dependencies.yml file is found and specifies at least one package; otherwise, None
- Returns
check_for_package_upgrades: traverses the dependencies inDbtPackageFileand for each package, determines if the current installed versions is Fusion compatible; if not, it looks for any Fusion-compatible versions of the package- Returns list of
PackageVersionUpgradeResult- Length should exactly match the number of packages in the
DbtPackageFile's dependencies
- Length should exactly match the number of packages in the
- Returns list of
upgrade_package_versions: takes thePackageVersionUpgradeResultlist and if any packages need updates, it identifies the required changes in packages.yml. For a dry run, it prints out the new packages.yml; otherwise, it actually makes the changes in the file.- Returns a single
PackageUpgradeResult
- Returns a single
print_to_consoleon thePackageUpgradeResult
upgrade_packages will generate an error if:
- the path specified in
--pathdoes not exist or isn't a directory generate_package_dependenciescan't find a packages.yml or dependencies.ymlgenerate_package_dependenciesfound a packages.yml or dependencies.yml but it didn't contain any package dependencies