Import dbt models as Feast FeatureViews. This command parses a dbt manifest.json file and creates corresponding Feast DataSource and FeatureView objects. Examples: # Import all models with 'feast' tag feast dbt import -m target/manifest.json -e driver_id --tag fea
(
ctx: click.Context,
manifest_path: str,
entity_columns: tuple,
data_source_type: str,
timestamp_field: str,
tag_filter: Optional[str],
model_names: tuple,
ttl_days: int,
dry_run: bool,
exclude_columns: Optional[str],
output: Optional[str],
)
| 89 | ) |
| 90 | @click.pass_context |
| 91 | def import_command( |
| 92 | ctx: click.Context, |
| 93 | manifest_path: str, |
| 94 | entity_columns: tuple, |
| 95 | data_source_type: str, |
| 96 | timestamp_field: str, |
| 97 | tag_filter: Optional[str], |
| 98 | model_names: tuple, |
| 99 | ttl_days: int, |
| 100 | dry_run: bool, |
| 101 | exclude_columns: Optional[str], |
| 102 | output: Optional[str], |
| 103 | ): |
| 104 | """ |
| 105 | Import dbt models as Feast FeatureViews. |
| 106 | |
| 107 | This command parses a dbt manifest.json file and creates corresponding |
| 108 | Feast DataSource and FeatureView objects. |
| 109 | |
| 110 | Examples: |
| 111 | |
| 112 | # Import all models with 'feast' tag |
| 113 | feast dbt import -m target/manifest.json -e driver_id --tag feast |
| 114 | |
| 115 | # Import specific models |
| 116 | feast dbt import -m target/manifest.json -e customer_id --model orders --model customers |
| 117 | |
| 118 | # Dry run to preview changes |
| 119 | feast dbt import -m target/manifest.json -e driver_id --tag feast --dry-run |
| 120 | |
| 121 | # Generate Python file instead of applying to registry |
| 122 | feast dbt import -m target/manifest.json -e driver_id --tag feast --output features.py |
| 123 | """ |
| 124 | from feast.dbt.mapper import DbtToFeastMapper |
| 125 | from feast.dbt.parser import DbtManifestParser |
| 126 | |
| 127 | # Parse manifest |
| 128 | click.echo(f"{Fore.CYAN}Parsing dbt manifest: {manifest_path}{Style.RESET_ALL}") |
| 129 | |
| 130 | try: |
| 131 | parser = DbtManifestParser(manifest_path) |
| 132 | parser.parse() |
| 133 | except FileNotFoundError as e: |
| 134 | click.echo(f"{Fore.RED}Error: {e}{Style.RESET_ALL}", err=True) |
| 135 | raise SystemExit(1) |
| 136 | except ValueError as e: |
| 137 | click.echo(f"{Fore.RED}Error: {e}{Style.RESET_ALL}", err=True) |
| 138 | raise SystemExit(1) |
| 139 | |
| 140 | # Display manifest info |
| 141 | if parser.dbt_version: |
| 142 | click.echo(f" dbt version: {parser.dbt_version}") |
| 143 | if parser.project_name: |
| 144 | click.echo(f" Project: {parser.project_name}") |
| 145 | |
| 146 | # Convert tuple to list and validate |
| 147 | entity_cols: List[str] = list(entity_columns) if entity_columns else [] |
| 148 |
nothing calls this directly
no test coverage detected