-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to add dbt packages in CLI without meltano add transform ...
#10
Comments
Originally this was authored before we had We basically already have it written in show code def add_to_packages(self, plugin: ProjectPlugin) -> None:
"""Add the plugin's package to the project's `packages.yml` file.
Args:
plugin: The plugin to add to the project.
Raises:
ValueError: If the plugin is missing the git repo URL.
"""
if not os.path.exists(self.packages_file):
self.packages_file.touch()
package_yaml = yaml.load(self.packages_file) or {"packages": []}
git_repo = plugin.pip_url
if not git_repo:
raise ValueError(f"Missing pip_url for transform plugin '{plugin.name}'")
revision: str | None = None
if len(git_repo.split("@")) == 2:
git_repo, revision = git_repo.split("@")
for package in package_yaml["packages"]:
same_ref = (
package.get("git", "") == git_repo
and package.get("revision", None) == revision
)
if same_ref:
return
package_ref = {"git": git_repo}
if revision:
package_ref["revision"] = revision
package_yaml["packages"].append(package_ref)
with open(self.packages_file, "w") as f:
yaml.dump(package_yaml, f) |
DBT added this in dbt-core 1.7, I just tried and it with
|
@BuzzCutNorman that's nice! Did you use it with cc @pnadolny13 Maybe relevant: |
@edgarrmondragon Yes sir I did. Here is the command I used.
I manually set
cc @pnadolny13 |
Thanks for confirming @BuzzCutNorman 🙂 I've bumped the dbt utilites in meltano/hub#1644, so folks should be getting the latest features like |
Migrated from GitLab: https://gitlab.com/meltano/meltano/-/issues/3536
Originally created by @aaronsteers on 2022-05-26 20:17:07
Long-term, I'd like to replace this in sample scripts...
...with this...
Then we can refer users to hub.getdbt.com for transform packages, while still having nice inline-able sample code. This won't happen in the short term though, and to keep samples working I think we have to accept
meltano add transform dbt-tap-gitlab
as sourced from the hub for a little while longer.This also opens up a very broad range of utilities and transformation packages, both from the dbt community as well as the Meltano community. It also makes installing things like
dbt-utils
package much easier and faster for Meltano users.Also logged as feature request here:
If added as a feature to dbt CLI, then we would not need to built into our own CLI.
The text was updated successfully, but these errors were encountered: