Skip to content

[FEATURE] Add find command for catalog search #172

@nadavs123

Description

@nadavs123

Use Case / Problem

Currently, there's no way to search for Fabric items across workspaces from the CLI.
Users must either:

  • Navigate to each workspace individually with ls
  • Use the Fabric portal's OneLake catalog UI
  • Make direct API calls

This creates friction when users need to quickly locate items by name or description across their tenant.

Proposed Solution

Add a new find command to search across all accessible workspaces.

Command Syntax

# Basic search
fab find "sales report"

# Filter by item type (space-separated)
fab find "data" --type Lakehouse

# Multiple types
fab find "monthly" --type Report Warehouse

# Limit results
fab find "dashboard" --limit 10

# Detailed view (shows IDs for scripting)
fab find "sales" --detailed

# Combine filters
fab find "finance" --type Warehouse Lakehouse --limit 20

Flags

Flag Description
--type Filter by item type(s), comma-separated
--limit Maximum results (default: 50)
--detailed Show all item properties including IDs

Search Matching

The search query matches against any of these fields:

  • displayName - Item name
  • workspaceName - Workspace containing the item
  • description - Item description

Default Output

Searching catalog for 'sales report'...
3 item(s) found

name             type       workspace          description
───────────────  ─────────  ─────────────────  ─────────────────────────────────
Sales Report Q1  Report     Finance Reports    Quarterly sales analysis for Q1
Sales Report Q2  Report     Finance Reports    Monthly sales summary
Sales Data       Lakehouse  Analytics Team     Raw sales data lakehouse

Detailed Output (--detailed)

Searching catalog for 'sales report'...
3 item(s) found

id                                    name             type       workspaceId                           workspace          description
────────────────────────────────────  ───────────────  ─────────  ────────────────────────────────────  ─────────────────  ─────────────────────────────────
0acd697c-1550-43cd-b998-91bfb12347c6  Sales Report Q1  Report     18cd155c-7850-15cd-a998-91bfb12347aa  Finance Reports    Quarterly sales analysis for Q1
...

Users can then reference items using the standard CLI path format:

fab get "Finance Reports.Workspace/Sales Report Q1.Report"

Output Format Support

The command supports the global --output_format flag:

  • --output_format text (default): Table output
  • --output_format json: JSON output for scripting

Error Handling

The command uses structured errors via FabricCLIError:

Error Code Message
Unsupported type ERROR_UNSUPPORTED_ITEM_TYPE "Item type 'Dashboard' is not searchable via catalog search API. Unsupported types: Dashboard, Dataflow, Scorecard"
Unknown type ERROR_INVALID_ITEM_TYPE "Unknown item type: 'FakeType'. Use tab completion to see valid types."
Invalid limit (argparse) "must be between 1 and 1000, got {value}"
API failure (from response) "Catalog search failed: {error message}"
Empty results (info) "No items found."

Pagination

  • Pagination is handled automatically by do_request() using continuation tokens
  • --limit acts as pageSize in the request
  • When more results exist, the output shows "(more available)"

Alternatives Considered

  • ls with grep: Requires knowing the workspace, doesn't search descriptions
  • Admin APIs: Requires admin permissions, overkill for personal discovery
  • Portal search: Not scriptable, breaks CLI-first workflows

Impact Assessment

  • This would help me personally
  • This would help my team/organization
  • This would help the broader fabric-cli community
  • This aligns with Microsoft Fabric roadmap items

Implementation Attestation

  • I understand this feature should maintain backward compatibility with existing commands
  • I confirm this feature request does not introduce performance regressions for existing workflows
  • I acknowledge that new features must follow fabric-cli's established patterns and conventions

Implementation Notes

  • Uses Catalog Search API (POST /v1/catalog/search)
  • The API currently does not support searching: Dashboard, Dataflow (Gen1/Gen2), Scorecard
  • Uses print_output_format() for output format support
  • Uses nargs="+" for --type flag following CLI conventions
  • Tab-completion via argcomplete for --type flag
  • Structured error handling with FabricCLIError and existing error codes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds triageThis is a new issue that needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions