MCPcopy Index your code
hub / github.com/feast-dev/feast / list_command

Function list_command

sdk/python/feast/cli/dbt_import.py:351–410  ·  view source on GitHub ↗

List dbt models available for import. Examples: # List all models feast dbt list -m target/manifest.json # List models with specific tag feast dbt list -m target/manifest.json --tag feast # Show column details feast dbt list -m target/mani

(
    manifest_path: str,
    tag_filter: Optional[str],
    show_columns: bool,
)

Source from the content-addressed store, hash-verified

349 help="Show column details for each model",
350)
351def list_command(
352 manifest_path: str,
353 tag_filter: Optional[str],
354 show_columns: bool,
355):
356 """
357 List dbt models available for import.
358
359 Examples:
360
361 # List all models
362 feast dbt list -m target/manifest.json
363
364 # List models with specific tag
365 feast dbt list -m target/manifest.json --tag feast
366
367 # Show column details
368 feast dbt list -m target/manifest.json --show-columns
369 """
370 from feast.dbt.parser import DbtManifestParser
371
372 click.echo(f"{Fore.CYAN}Parsing dbt manifest: {manifest_path}{Style.RESET_ALL}")
373
374 try:
375 parser = DbtManifestParser(manifest_path)
376 parser.parse()
377 except (FileNotFoundError, ValueError) as e:
378 click.echo(f"{Fore.RED}Error: {e}{Style.RESET_ALL}", err=True)
379 raise SystemExit(1)
380
381 if parser.dbt_version:
382 click.echo(f" dbt version: {parser.dbt_version}")
383 if parser.project_name:
384 click.echo(f" Project: {parser.project_name}")
385
386 models = parser.get_models(tag_filter=tag_filter)
387
388 if not models:
389 click.echo(f"{Fore.YELLOW}No models found.{Style.RESET_ALL}")
390 return
391
392 click.echo(f"\n{Fore.GREEN}Found {len(models)} model(s):{Style.RESET_ALL}\n")
393
394 for model in models:
395 tags_str = f" [tags: {', '.join(model.tags)}]" if model.tags else ""
396 click.echo(f"{Fore.CYAN}{model.name}{Style.RESET_ALL}{tags_str}")
397 click.echo(f" Table: {model.full_table_name}")
398 if model.description:
399 desc = model.description[:80] + (
400 "..." if len(model.description) > 80 else ""
401 )
402 click.echo(f" Description: {desc}")
403
404 if show_columns and model.columns:
405 click.echo(f" Columns ({len(model.columns)}):")
406 for col in model.columns:
407 type_str = col.data_type or "unknown"
408 click.echo(f" - {col.name}: {type_str}")

Callers

nothing calls this directly

Calls 4

parseMethod · 0.95
get_modelsMethod · 0.95
DbtManifestParserClass · 0.90
joinMethod · 0.45

Tested by

no test coverage detected