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
fab find "revenue" -P type=Lakehouse

# Multiple types (bracket syntax)
fab find "monthly" -P type=[Report,Warehouse]

# Exclude types
fab find "data" -P type!=Dashboard
fab find "data" -P type!=[Dashboard,Datamart]

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

# Combine filters
fab find "finance" -P type=[Warehouse,Lakehouse] -l

# JMESPath client-side filtering
fab find "sales" -q "[?type=='Lakehouse']"

Flags

Flag Description
-P/--params Parameters in key=value format. Supported: type= (eq) and type!= (ne)
-l/--long Show detailed output with IDs
-q/--query JMESPath expression for client-side filtering

Search Matching

The search query matches against any of these fields:

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

Default Output (interactive mode)

fab > find 'sales report'
Searching catalog for 'sales report'...

50 item(s) found (more available)

name             type       workspace          description
───────────────  ─────────  ─────────────────  ─────────────────────────────────
Sales Report Q1  Report     Finance Reports    Quarterly sales analysis for Q1
Sales Report Q2  Report     Finance Reports    Monthly sales summary
...

Press any key to continue... (Ctrl+C to stop)

34 item(s) found

name             type       workspace          description
───────────────  ─────────  ─────────────────  ─────────────────────────────────
Sales Data       Lakehouse  Analytics Team     Raw sales data lakehouse
...

84 total item(s)

Long Output (-l/--long)

Searching catalog for 'sales report'...

3 item(s) found

Name: Sales Report Q1
ID: 0acd697c-1550-43cd-b998-91bfb12347c6
Type: Report
Workspace: Finance Reports
Workspace ID: 18cd155c-7850-15cd-a998-91bfb12347aa
Description: Quarterly sales analysis for Q1

Name: Sales Report Q2
ID: 1bde708d-2661-54de-c009-02cgc23458d7
Type: Report
Workspace: Finance Reports
Workspace ID: 29de266d-8961-26de-b009-02cgc23458bb

Note: Empty fields (e.g., Description) are hidden for cleaner output.

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 or key-value 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"
Unknown type ERROR_INVALID_ITEM_TYPE "Unknown item type: 'FakeType'. Valid types: ..."
Invalid param ERROR_INVALID_INPUT "Invalid parameter format: 'foo'. Expected key=value."
Unknown param ERROR_INVALID_INPUT "Unknown parameter: 'foo'. Supported: type"
API failure (from response) "Catalog search failed: {error message}"
Empty results (info) "No items found."

Pagination

Pagination is handled automatically based on CLI mode:

  • Interactive mode: Fetches 50 items per page. After each page, if more results are available, prompts "Press any key to continue... (Ctrl+C to stop)". Displays a running total at the end.
  • Command-line mode: Fetches all pages automatically (1,000 items per page). All results are accumulated and displayed as a single table.

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)
  • Type filtering via -P type=Report,Lakehouse using key=value param pattern; supports negation (type!=Dashboard) and bracket syntax (type=[Report,Lakehouse])
  • Type names are case-insensitive (normalized to PascalCase internally)
  • Interactive mode: pages 50 at a time with continuation tokens behind the scenes
  • Command-line mode: fetches all pages automatically (1,000 per page)
  • Descriptions truncated to terminal width in compact view; full text available via -l
  • The API currently does not support searching: Dashboard
  • Note: Dataflow Gen1 and Gen2 are currently not searchable; only Dataflow Gen2 CI/CD items are returned (as type 'Dataflow'). Scorecards are returned as type 'Report'.
  • Uses print_output_format() for output format support
  • Uses show_key_value_list=True for -l/--long vertical layout
  • Structured error handling with FabricCLIError and existing error codes

Metadata

Metadata

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