Skip to content

Architecture Overview

ohadedry edited this page Oct 22, 2025 · 2 revisions

Fabric CLI is designed with a modular architecture centered around these key concepts:

Elements Hierarchy

Fabric CLI uses an element hierarchy system:

  • Tenants - Top-level containers (capacities, gateways, domains)
  • Workspaces - Project containers within tenants
  • Folders - Organizational containers within workspaces for grouping items
  • Items - Fabric entities (notebooks, datasets, reports, etc.)
  • OneLake - File storage within items

Each element type has specific supported operations and properties.

Output format

When developing new commands, it's important to consider the supported output formats and use the appropriate print functions for displaying command results (print_output_format, print_error_format) and for user-facing messages during execution (print_info, print_warning, etc.). Currently, we support two formats: json and text (default).

Error handling

Error type

Fabric CLI errors should be raised using the FabricCLIError type. Use this for user-facing errors that need to be reported to the CLI user, not for internal exceptions. All Fabric CLI commands are wrapped to handle this error type, printing the error message and error code to the user.

Error messages

  • Create new error messages under the errors folder inside a module relevant to the error.
  • Before creating a new error message, check if an existing one can be reused.
  • Error messages should be clear, user-friendly, and avoid technical jargon unless necessary.
  • Where possible, include actionable advice (e.g., "Check your network connection").

Error codes

  • All error codes should be created inside the constant.py module under the error codes region.
  • Before creating a new error code, check for reusing an existing one.

Example

from fabric_cli.core import fab_constant
from fabric_cli.core.fab_exceptions import FabricCLIError
from fabric_cli.errors import ErrorMessages

# Example of raising an error
raise FabricCLIError(ErrorMessages.Common.file_or_directory_not_exists(), fab_constant.ERROR_INVALID_PATH)

Clone this wiki locally