-
Notifications
You must be signed in to change notification settings - Fork 225
Support dbt 2.0 / Fusion in the edr CLI #2333
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
Open
haritamar
wants to merge
17
commits into
master
Choose a base branch
from
core-1344-support-dbt-20-fusion-in-the-edr-cli
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7b2dffe
Support dbt 2.0 / Fusion in the edr CLI
devin-ai-integration[bot] 970e91e
Fix CI for dbt 2.x targets: jinja2 dep, config-strip ordering, API te…
devin-ai-integration[bot] 121dcbf
Document E2E project's minimum dbt-core version
devin-ai-integration[bot] b0f2fb7
Make e2e run validation status-based (dbt 2.0 reports ephemeral model…
devin-ai-integration[bot] 1208689
CI: render e2e package path for dbt 2.x, surface run validation failures
devin-ai-integration[bot] 544e51b
Add job timeout to warehouse test workflow
devin-ai-integration[bot] d1c4330
Use a per-dbt-version seeds schema to avoid concurrent CI conflicts
devin-ai-integration[bot] 0ccb0b6
Read the seeds schema from TEST_SEEDS_SCHEMA in the Spark external se…
devin-ai-integration[bot] fa0d2b6
Pin dbt Fusion to 2.0.0rc205 in CI to avoid Snowflake hangs in rc212
devin-ai-integration[bot] ba5bdc9
Reject dbt 2.x/fusion with vertica in CI; quote seed schema in Spark …
devin-ai-integration[bot] f9675d3
Repin fusion to rc212; use threads=1 for fusion/snowflake to avoid dr…
devin-ai-integration[bot] 0f4c38d
Apply snowflake threads=1 mitigation to dbt-core 2.x jobs too
devin-ai-integration[bot] 7b668ae
Support generic '2.x' dbt version that tracks the latest dbt-core 2.x…
devin-ai-integration[bot] 02d3963
Fix 2.x version spec: prereleases order below 2.0.0 under PEP 440
devin-ai-integration[bot] 341f80f
Pass --threads 1 explicitly for dbt 2.x snowflake jobs (dbt-core 2.0.…
devin-ai-integration[bot] 77900c0
Exclude dbt-core 2.x snowflake job: 2.0.0b2 engine hangs even with th…
devin-ai-integration[bot] bf732d6
Retrigger CI (transient databricks connectivity timeout in send-report)
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| from elementary.clients.dbt.dbt_installation import get_dbt2_binary_path | ||
| from elementary.clients.dbt.subprocess_dbt_runner import SubprocessDbtRunner | ||
|
|
||
|
|
||
| class Dbt2Runner(SubprocessDbtRunner): | ||
| """Runner for dbt 2.0 (the Fusion engine), which is distributed as a | ||
| standalone binary (via the `dbt` PyPI package, the `dbt-core` 2.x package | ||
| or the standalone installer) and has no importable Python API.""" | ||
|
|
||
| def _get_dbt_command_name(self) -> str: | ||
| return get_dbt2_binary_path() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,4 @@ | ||
| import os | ||
| # Kept for backward compatibility; use Dbt2Runner instead. | ||
| from elementary.clients.dbt.dbt2_runner import Dbt2Runner as DbtFusionRunner | ||
|
|
||
| from elementary.clients.dbt.subprocess_dbt_runner import SubprocessDbtRunner | ||
|
|
||
| DBT_FUSION_PATH = os.getenv("DBT_FUSION_PATH", "~/.local/bin/dbt") | ||
|
|
||
|
|
||
| class DbtFusionRunner(SubprocessDbtRunner): | ||
| def _get_dbt_command_name(self) -> str: | ||
| return os.path.expanduser(DBT_FUSION_PATH) | ||
|
|
||
| def _run_deps_if_needed(self): | ||
| # Currently we don't support auto-updating deps for dbt fusion | ||
| return | ||
| __all__ = ["DbtFusionRunner"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import os | ||
| import shutil | ||
| from importlib import metadata | ||
| from typing import Optional | ||
|
|
||
| from packaging import version | ||
|
|
||
| DBT_FUSION_PATH_ENV_VAR = "DBT_FUSION_PATH" | ||
| DEFAULT_DBT_FUSION_PATH = "~/.local/bin/dbt" | ||
|
|
||
|
|
||
| def _get_package_version(package_name: str) -> Optional[version.Version]: | ||
| try: | ||
| return version.Version(metadata.version(package_name)) | ||
| except (metadata.PackageNotFoundError, version.InvalidVersion): | ||
| return None | ||
|
|
||
|
|
||
| def get_dbt_core_version() -> Optional[version.Version]: | ||
| """Version of the installed `dbt-core` package, or None if not installed.""" | ||
| return _get_package_version("dbt-core") | ||
|
|
||
|
|
||
| def get_dbt_package_version() -> Optional[version.Version]: | ||
| """Version of the installed `dbt` package, or None if not installed. | ||
|
|
||
| From 2.0, the `dbt` package on PyPI ships the dbt (Fusion) binary as a | ||
| platform wheel with no importable Python module. | ||
| """ | ||
| return _get_package_version("dbt") | ||
|
|
||
|
|
||
| def is_dbt2_binary_available() -> bool: | ||
| env_path = os.getenv(DBT_FUSION_PATH_ENV_VAR) | ||
| if env_path and os.path.exists(os.path.expanduser(env_path)): | ||
| return True | ||
|
|
||
| dbt_package_version = get_dbt_package_version() | ||
| if dbt_package_version is not None and dbt_package_version.major >= 2: | ||
| return True | ||
| return os.path.exists(os.path.expanduser(DEFAULT_DBT_FUSION_PATH)) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def get_dbt2_binary_path() -> str: | ||
| env_path = os.getenv(DBT_FUSION_PATH_ENV_VAR) | ||
| if env_path: | ||
| return os.path.expanduser(env_path) | ||
|
|
||
| # When only dbt-core 1.x is installed, the `dbt` executable on PATH is its | ||
| # entrypoint, so it can't be trusted to be the dbt 2.0 binary. | ||
| dbt_core_version = get_dbt_core_version() | ||
| dbt_package_version = get_dbt_package_version() | ||
| dbt2_installed_via_pip = ( | ||
| dbt_package_version is not None and dbt_package_version.major >= 2 | ||
| ) or (dbt_core_version is not None and dbt_core_version.major >= 2) | ||
| if dbt2_installed_via_pip or dbt_core_version is None: | ||
| which_path = shutil.which("dbt") | ||
| if which_path: | ||
| return which_path | ||
|
|
||
| return os.path.expanduser(DEFAULT_DBT_FUSION_PATH) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.