Skip to content

feat: add find command for catalog search#174

Open
nadavs123 wants to merge 21 commits intomicrosoft:mainfrom
nadavs123:feature/catalog-search-find-command
Open

feat: add find command for catalog search#174
nadavs123 wants to merge 21 commits intomicrosoft:mainfrom
nadavs123:feature/catalog-search-find-command

Conversation

@nadavs123
Copy link

📥 Pull Request

Closes #172

Summary

Adds a new find command that searches for Fabric items across all accessible workspaces using the Catalog Search API (POST /v1/catalog/search).

Usage

# Basic search
fab find "sales report"

# Filter by item type(s)
fab find "data" --type Lakehouse
fab find "monthly" --type Report Warehouse

# Limit results
fab find "dashboard" --max-items 10

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

# Pagination
fab find --next-token "eyJTa2lwIjoy..."

Flags

Flag Description
--type Filter by item type(s), space-separated
--max-items Maximum results per page (1-1000)
-l/--long Show detailed output with IDs
--next-token Continuation token for next page

Implementation details

  • Follows existing CLI patterns: @fab_command decorator, print_output_format(), FabricCLIError
  • Tab-completion for --type via argcomplete
  • --max-items validation (1-1000)
  • Structured error handling for unsupported/unknown types, missing query, API failures
  • Description column hidden in compact mode when no items have descriptions
  • Empty fields hidden in long (-l) mode
  • Pagination via --next-token (continuation token approach)

Files added

  • src/fabric_cli/client/fab_api_catalog.py — API client
  • src/fabric_cli/commands/find/__init__.py — Package init
  • src/fabric_cli/commands/find/fab_find.py — Command logic
  • src/fabric_cli/parsers/fab_find_parser.py — Argument parser
  • tests/test_commands/find/__init__.py — Test package init
  • tests/test_commands/find/test_find.py — 22 unit tests
  • .changes/unreleased/added-20260209-171617.yaml — Changie entry

Files modified

  • src/fabric_cli/core/fab_parser_setup.py — Register find parser

Notes

  • Dashboard is the only unsupported item type
  • Dataflow Gen1/Gen2 are currently not searchable; only Dataflow Gen2 CI/CD is returned (as type Dataflow)
  • Scorecards are returned as type Report
  • Requires Catalog.Read.All scope (not yet added to CLI app registration)

Nadav Schachter added 21 commits February 9, 2026 17:51
Features:
- Search across all workspaces by displayName, workspaceName, or description
- Filter by item type with --type flag
- Limit results with --limit flag
- Detailed output with --detailed flag (includes id, workspaceId)
- Custom endpoint support with --endpoint flag or FAB_CATALOG_ENDPOINT env var

Output columns (default): name, type, workspace, description
Output columns (detailed): + workspaceId, id

Required scope: Catalog.Read.All
Unsupported types: Dashboard, Dataflow, Scorecard

Includes unit tests (12 tests passing)
…dling

Changes based on issue microsoft#172 feedback:
- Changed --type from comma-separated to nargs='+' (space-separated)
- Removed --endpoint flag (use internal mechanism instead)
- Added FabricCLIError for invalid/unsupported item types
- Added error handling for API failures
- Updated tests to match new patterns (15 tests passing)
- Added complete_item_types() completer for searchable types
- Tab completion excludes unsupported types (Dashboard, Dataflow, Scorecard)
- Restored unsupported type validation with clear error message
- Updated ALL_ITEM_TYPES list from official API spec
- Added SEARCHABLE_ITEM_TYPES for valid filter types
- 20 tests passing
- Keep tab-completion for --type flag
- Custom FabricCLIError for unsupported types (Dashboard, Dataflow, Scorecard)
- Custom FabricCLIError for unknown types
- Cleaner error messages vs argparse choices listing all 40+ types
- 22 tests passing
- Changed from data= to json= for request payload
- Added raw_response=True to avoid auto-pagination hanging
- Added fallback from displayName to name (API bug workaround)
- Updated tests to use dict instead of JSON string
- Successfully tested against dailyapi.fabric.microsoft.com
@nadavs123 nadavs123 requested a review from a team as a code owner February 15, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add find command for catalog search

1 participant