Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
support dbt-core between 1.7.0 to 1.7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
salim_moulouel committed Feb 26, 2024
1 parent cbdfc5d commit 9463fad
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- "3.10"
# - "3.11"
dbt:
- "1.5.*"
- "1.7.*"

# Run only the latest commit pushed to PR
concurrency:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_integration_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
# - duckdb
# - sqlserver
dbt_version:
- "1.5.0"
- "1.7.0"
python:
- "3.8"
- "3.9"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_integration_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ on:
options:
- "<ALL>"
- "latest"
- "1.5.*"
- "1.7.*"

jobs:
matrix-adapter:
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
shell: python
run: |
OPTIONS = [
"1.5.*",
"1.7.*",
]
OUTPUT = OPTIONS
Expand Down
4 changes: 2 additions & 2 deletions projects/adapter/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dbt-fal"
version = "1.5.10a0"
version = "1.7.10a0"
# name = "fal"
# version = "0.9.4a0"
description = "Run python scripts from any dbt project."
Expand All @@ -22,7 +22,7 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.8"
dbt-core = ">=1.5,<=1.5.5"
dbt-core = ">=1.7,<=1.7.8"
pandas = "^1.3.4"
posthog = "^1.4.5"
"backports.functools_lru_cache" = "^1.6.4"
Expand Down
2 changes: 1 addition & 1 deletion projects/adapter/src/dbt/adapters/fal/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '1.5.10a0'
version = '1.7.10a0'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '1.5.10a0'
version = '1.7.10a0'
4 changes: 4 additions & 0 deletions projects/adapter/src/fal/dbt/cli/fal_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ def create_fal_dbt(
args: argparse.Namespace, generated_models: Dict[str, Path] = {}
) -> FalDbt:
real_state = None
real_defer_state = None
if hasattr(args, "state") and args.state is not None:
real_state = args.state
if hasattr(args, "real_defer_state") and args.defer_state is not None:
real_defer_state = args.state

return FalDbt(
args.project_dir,
Expand All @@ -25,6 +28,7 @@ def create_fal_dbt(
args.selector,
args.threads,
real_state,
real_defer_state,
args.target,
args.vars,
generated_models,
Expand Down
4 changes: 2 additions & 2 deletions projects/adapter/src/fal/dbt/integration/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Any, List, Dict, Optional, Union, TYPE_CHECKING

from dbt.contracts.project import Project as ProjectContract
from dbt.config import RuntimeConfig, Project
from dbt.config import RuntimeConfig, Project, PartialProject
from dbt.config.utils import parse_cli_vars as dbt_parse_cli_vars
from dbt.contracts.graph.manifest import Manifest
from dbt.contracts.results import RunResultsArtifact, FreshnessExecutionResultArtifact
Expand Down Expand Up @@ -47,7 +47,7 @@ class RuntimeArgs:


def load_dbt_project_contract(project_dir: str) -> ProjectContract:
partial_project = Project.partial_load(project_dir)
partial_project = PartialProject.from_project_root(project_dir)
contract = ProjectContract.from_dict(partial_project.project_dict)
if not hasattr(contract, "model_paths") or contract.model_paths is None:
setattr(contract, "model_paths", contract.source_paths)
Expand Down
8 changes: 7 additions & 1 deletion projects/adapter/src/fal/dbt/integration/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ class CompileArgs:
models: List[str]
exclude: Tuple[str]
state: Optional[Path]
defer_state: Optional[Path]
single_threaded: Optional[bool]


Expand All @@ -453,6 +454,7 @@ def __init__(
selector: Optional[str] = None,
threads: Optional[int] = None,
state: Optional[str] = None,
defer_state: Optional[str] = None,
profile_target: Optional[str] = None,
args_vars: str = "{}",
generated_models: Dict[str, Path] = {},
Expand Down Expand Up @@ -485,9 +487,13 @@ def __init__(
self.profiles_dir = flags.PROFILES_DIR

self._state = None
self._defer_state = None
if state is not None:
self._state = Path(os.path.realpath(os.path.expanduser(state)))

if defer_state is not None:
self._defer_state = Path(os.path.realpath(os.path.expanduser(defer_state)))

self.scripts_dir = parse.get_scripts_dir(self.project_dir, args_vars)


Expand Down Expand Up @@ -525,7 +531,7 @@ def __init__(
# Necessary for manifest loading to not fail
# dbt.tracking.initialize_tracking(self.profiles_dir)

args = CompileArgs(selector, select, select, exclude, self._state, None)
args = CompileArgs(selector, select, select, exclude, self._state, self._defer_state, None)
self._compile_task = CompileTask(args, self._config, native_manifest)

self._compile_task._runtime_initialize()
Expand Down

0 comments on commit 9463fad

Please sign in to comment.