Skip to content

yggdrasil.cli.databricks

databricks

Databricks CLIs.

Sub-services each ship a small CLI subclass under :mod:yggdrasil.cli.databricks — all of them share the :class:DatabricksCLI base which owns the workspace-client flag group (--host / --token / --profile / etc.) and the :class:DatabricksClient construction handshake.

Currently registered:

  • :class:yggdrasil.cli.databricks.genie.GenieCLI — conversational Genie agent CLI (ygg-genie).

Add a new sub-service CLI by subclassing :class:DatabricksCLI, overriding :meth:DatabricksCLI.add_service_arguments with any service-specific flags, and implementing :meth:DatabricksCLI.run.

DatabricksCLI

DatabricksCLI(client: 'DatabricksClient', args: Namespace)

Bases: ABC

Abstract base for ygg-<service> console scripts.

Concrete subclasses live in yggdrasil.cli.databricks.<service> and expose a module-level main(argv=None) function that simply calls cls.parse_and_run(argv).

Attributes

prog Program name shown in --help. Set on the subclass. description One-line description shown in --help. epilog Optional example block appended to --help output.

build_parser classmethod

build_parser() -> argparse.ArgumentParser

Build the argparse tree: client group + service flags.

add_service_arguments abstractmethod classmethod

add_service_arguments(parser: ArgumentParser) -> None

Attach service-specific flag groups to parser.

Subclasses override to declare their own argument groups. The method runs once per parser build — keep it side-effect-free.

client_kwargs staticmethod

client_kwargs(args: Namespace) -> dict[str, Any]

Return the :class:DatabricksClient kwargs supplied on the CLI.

Skips fields the caller left at None so the client falls back to its env defaults (DATABRICKS_*).

build_client classmethod

build_client(args: Namespace) -> 'DatabricksClient'

Construct the :class:DatabricksClient from CLI args.

Lazy-imports the client so ygg-<service> --help doesn't pay the SDK import cost.

parse_and_run classmethod

parse_and_run(argv: Optional[Sequence[str]] = None) -> int

End-to-end: build parser, parse, build client, dispatch :meth:run.

Returns the process exit code so concrete entry points can return DatabricksCLI.parse_and_run(...).

run abstractmethod

run() -> int

Run the sub-service. Returns a process exit code.