◐ Shell
reader mode source ↗
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
7 changes: 2 additions & 5 deletions sdk/python/feast/cli/dbt_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ def import_command(
try:
parser = DbtManifestParser(manifest_path)
parser.parse()
except FileNotFoundError as e:
click.echo(f"{Fore.RED}Error: {e}{Style.RESET_ALL}", err=True)
raise SystemExit(1)
except ValueError as e:
click.echo(f"{Fore.RED}Error: {e}{Style.RESET_ALL}", err=True)
raise SystemExit(1)

Expand Down @@ -374,7 +371,7 @@ def list_command(
try:
parser = DbtManifestParser(manifest_path)
parser.parse()
except (FileNotFoundError, ValueError) as e:
click.echo(f"{Fore.RED}Error: {e}{Style.RESET_ALL}", err=True)
raise SystemExit(1)

Expand Down
39 changes: 38 additions & 1 deletion sdk/python/feast/dbt/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"""

import json
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional
Expand Down Expand Up @@ -79,6 +80,34 @@ def __init__(self, manifest_path: str):
self._raw_manifest: Optional[Dict[str, Any]] = None
self._parsed_manifest: Optional[Any] = None

def parse(self) -> None:
"""
Load and parse the manifest.json file using dbt-artifacts-parser.
Expand Down Expand Up @@ -108,7 +137,15 @@ def parse(self) -> None:
from dbt_artifacts_parser.parser import parse_manifest

assert self._raw_manifest is not None
self._parsed_manifest = parse_manifest(manifest=self._raw_manifest)
except ImportError:
raise ImportError(
"dbt-artifacts-parser is required for dbt integration.\n"
Expand Down
63 changes: 63 additions & 0 deletions sdk/python/tests/integration/dbt/test_dbt_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,16 @@ def test_codegen_online_false(self, parser):
class TestDbtCli:
"""Test the `feast dbt import` and `feast dbt list` CLI commands."""

def test_dbt_list_command(self, manifest_path):
from click.testing import CliRunner

Expand Down Expand Up @@ -1061,6 +1071,27 @@ def test_dbt_list_show_columns(self, manifest_path):
assert "driver_id" in result.output
assert "conv_rate" in result.output

def test_dbt_import_dry_run(self, manifest_path):
from click.testing import CliRunner

Expand All @@ -1086,6 +1117,38 @@ def test_dbt_import_dry_run(self, manifest_path):
assert result.exit_code == 0
assert "Dry run" in result.output

def test_dbt_import_output_codegen(self, manifest_path, tmp_path):
from click.testing import CliRunner

Expand Down
Loading
Toggle all file notes Toggle all file annotations