Rayfin

Connector

rayfin connector manages external Fabric sources, from discovery and registration through inspection and invocation.

Note

connector is registered only when connectors are enabled. Enable it with services.connectors.enabled: true in rayfin/rayfin.yml, with any non-empty top-level connectors: block, or for one command with RAYFIN_FEATURE_FLAGS=connectors. Without one of those opt-ins, the CLI reports connector as an unknown command.

Use rayfin connector to discover existing Microsoft Fabric sources, register them in rayfin.yml, inspect their read shape, and invoke configured operations. For the workflow and app-code model, start with Connectors; this page is the command reference.

npx rayfin connector <command>

Connector types

TypeFabric itemCategoryOperationsVersion
fabric-sqlanalyticsLakehouseCategory AreadNo
fabric-warehouseWarehouseCategory Aread, create, update, deleteNo
fabric-sqldatabaseSQL DatabaseCategory Aread, create, update, deleteNo
fabric-semanticmodelSemantic modelCategory BexecuteQueryPinned to '1' by connector add
kustoKQL DatabaseCategory BexecuteQuery, executeCommandPinned to '1' by connector add

Category A connectors generate entity configuration for Data API Builder. Category B connectors expose function-style query operations and are delegated-only. See Connectors, Fabric SQL sources, Semantic models, and KQL databases.

Subcommands

The registered subcommands are search, add, list, remove, types, inspect, and invoke.

npx rayfin connector search [query] --workspace-id <id> --type <type>
npx rayfin connector search [query] --all-workspaces --type <type>
npx rayfin connector search [query]

Searches Fabric items that the signed-in identity can add as connectors. Use one of these scopes:

ScopeRequired flagsBehavior
Single workspace--workspace-id <id> and --type <type>Searches one workspace.
Tenant-wide--all-workspaces and --type <type>Searches all accessible workspaces.
Deployed projectNo scope flagsSearches every workspace recorded in the project's deployments; --type is optional.
FlagDescription
[query]Optional case-insensitive item-name filter.
--query <text>Same filter as [query]; wins when both are provided.
--workspace-id <id>Search one Fabric workspace. Requires --type.
--all-workspacesSearch every workspace the signed-in identity can access. Requires --type.
--type <type>Narrow to one or more comma-separated connector types. Required with explicit workspace scope.
--limit <n>Limit non-interactive output to the first n results.
--output interactive|plain|jsonSelect output mode.
--jsonEmit one JSON object and skip the interactive picker.
-v, --verboseEnable verbose output. Cannot be combined with --json.
-y, --yesAuto-accept prompts in the interactive add handoff.

With --json, the command emits { status, query, scope, count, sources }. Each result in sources includes a suggested name and a ready-to-run addCommand.

connector add

npx rayfin connector add --type fabric-sqldatabase --workspace-id <id> --item-id <id> --name sales

Registers one source in rayfin/rayfin.yml and scaffolds rayfin/connectors/<name>/.

FlagDescription
--type <type>Required. One of the five connector type literals.
--workspace-id <id>Required Fabric workspace ID. Must be a literal value; ${VAR} placeholders are rejected.
--item-id <id>Required Fabric item ID. Must be a literal value; ${VAR} placeholders are rejected.
--name <name>Connector name. If omitted, the CLI derives one from the Fabric item display name. Must match /^[a-zA-Z0-9\-_]+$/ and be at most 256 characters.
--operations <ops>Comma-separated subset of allowed operations. This can narrow the catalog defaults but cannot widen them; there is no all meta-operation.
-y, --yesAuto-accept confirmation prompts, including overwriting an existing connector.
-v, --verboseEnable verbose output.
--jsonEmit machine-readable JSON.

The command verifies the Fabric item, writes the connectors: entry, and writes rayfin/connectors/<name>/schema.ts. For Category A it also runs schema discovery and writes metadata.json. For kusto, it resolves queryServiceUri and databaseName and bakes them into schema.ts; those values are not written to rayfin.yml.

For versioned Category B types (fabric-semanticmodel and kusto), connector add writes the catalog defaultVersion automatically. Today that value is '1'.

connector add does not install packages. It prints a version-pinned npm install command; with --json, the same data appears under install.packages and install.command.

connector list

npx rayfin connector list

Lists connectors declared in rayfin.yml. It does not call Fabric or the deployed workload.

FlagDescription
-v, --verboseInclude catalog metadata for each connector.
--jsonEmit the configured connector entries as JSON.

connector remove

npx rayfin connector remove sales --yes

Removes the named connector entry from rayfin.yml and deletes rayfin/connectors/<name>/.

FlagDescription
-y, --yesAuto-accept confirmation prompts. Required in non-interactive contexts for existing connectors.
-v, --verboseEnable verbose output.
--jsonEmit machine-readable JSON.

JSON output for a removed connector is { status, action: 'connector.remove', name, removed, directoryDeleted }.

connector types

npx rayfin connector types --verbose

Lists the connector catalog.

FlagDescription
-v, --verboseAdd category, default auth, dialect, operations, discoverable item types, required version, and client packages.
--output interactive|plain|jsonSelect output mode.
--jsonEmit the catalog as JSON.

--json emits the same detailed catalog fields as verbose mode.

connector inspect

npx rayfin connector inspect --name sales
npx rayfin connector inspect --name sales --entity dbo.Customers --rows 10
npx rayfin connector inspect --workspace-id <id> --item-id <id> --type fabric-warehouse --query queries\sample.sql

Inspects a source in read-only mode. It supports fabric-sqlanalytics, fabric-warehouse, fabric-sqldatabase, and fabric-semanticmodel. It does not support kusto; that type fails with Unsupported connector type: kusto.

FlagDescription
--name <name>Select a connector declared in rayfin.yml. Mutually exclusive with direct selectors.
--workspace-id <id> / --workspace <name>Direct mode workspace selector. Use with --item-id or --item and --type.
--item-id <id> / --item <name>Direct mode item selector. Use with a workspace selector and --type.
--type <type>Connector type for direct mode.
--url <portal-url>Semantic-model portal URL; extracts workspace and item IDs. Cannot be combined with other selectors.
--entity <name>Structured entity sampling mode.
--query <path>Raw query mode. Path must point to a .sql or .dax file inside the project.
--rows <n>Row cap. Default is 100 for entity listing and 10 for entity or query modes; maximum is 100.
-v, --verboseEnable verbose output.
--output interactive|plain|jsonSelect output mode.
--jsonEmit a machine-readable JSON object.

Inspect has three modes:

ModeHow to select itQuery shape
Entity listingOmit --entity and --querySQL uses INFORMATION_SCHEMA.TABLES; DAX uses INFO.TABLES().
Structured entityPass --entity <name>SQL builds SELECT TOP(n) * FROM <entity>; DAX builds EVALUATE TOPN(n, '<entity>').
Raw queryPass --query <path>Runs the .sql or .dax file verbatim.

SQL inspect accepts only read queries that start with SELECT or WITH; DML and DDL are rejected. DAX inspect requires the query to start with EVALUATE.

connector invoke

npx rayfin connector invoke mymodel executeQuery --input '{"query":"EVALUATE TOPN(10, Sales)"}'
npx rayfin connector invoke --name mymodel --operation executeQuery --file payload.json

Invokes one configured operation. The positional connector name and operation also have flag forms, --name and --operation; flag values win over positionals.

FlagDescription
<connector-name>Connector name declared in rayfin.yml.
<operation>Operation to invoke.
--name <name>Connector name flag form; wins over the positional.
--operation <operation>Operation flag form; wins over the positional.
--input '<json>'Inline JSON payload. Exactly one of --input or --file is required.
--file <path>JSON payload file, resolved against the project root. The resolved path must stay inside it; ..\ escapes are rejected before the file is read.
-v, --verboseEnable verbose output. Cannot be combined with --json.
--output interactive|plain|jsonSelect output mode.
--jsonEmit one machine-readable JSON object.

Operation names match case-insensitively against the connector's operations: list. If the entry has no operations, the command falls back to the connector type's full catalog allowlist.

Invoke transports

fabric-semanticmodel calls Fabric and Power BI directly under the developer's own identity. It works with or without rayfin up, and it requires workspaceId and itemId under the connector's config: block.

Every other type, including kusto, POSTs to the deployed item at /__private/connectors/<name>/invoke and requires a prior rayfin up.

Invoke token handling

rayfin login consents to the Fabric scope, not the Power BI scope the semantic-model path needs. Interactively, the CLI prompts to complete Power BI consent. With --json, token acquisition is silent-only so prompts cannot corrupt the single-JSON-object contract; if consent is still needed, the command fails and tells you to drop --json or set RAYFIN_TOKEN. When RAYFIN_TOKEN is set, it is passed through unchanged and its audience is decoded and checked locally.

Invoke output

Success emits { status: 'ok', connector, operation, output }. A resolved call is not automatically a success: a normalizing connector reports failure as status: 'error', and a connector returning a raw envelope reports failure as status: 'Failed'. The CLI converts either failure shape into a non-zero exit.

Note

Invoking a semantic model operation whose DAX returns Int64 columns, for example DISTINCTCOUNT, can fail while printing with Do not know how to serialize a BigInt even though the query succeeded. Select a non-Int64 column to read the output.

Invoke errors

MessageFix
Missing required connector invoke argumentsSupply both the connector name and the operation.
Choose exactly one payload source / Missing payload inputPass exactly one of --input or --file.
Input file must be inside the projectUse a relative path under the project root.
Operation "<op>" is not allowed for connector "<name>"Check the connector's operations: in rayfin.yml, or the type's allowlist.
missing workspaceId/itemId in rayfin.ymlAdd both under config:, or re-run connector add.
Access token has the wrong audience for the Power BI query APIUnset or replace RAYFIN_TOKEN, or re-run without --json to consent interactively.
No remote endpoint configuredThe non-semantic-model transport needs a deployed item; run npx rayfin up first.
PromptRegister a Fabric SQL Database connector
Add a Rayfin connector named "sales" for my Fabric SQL Database using `npx rayfin connector add --type fabric-sqldatabase --workspace-id <workspace-id> --item-id <item-id> --name sales`, then show me the resulting rayfin.yml entry and the scaffolded rayfin/connectors/sales/schema.ts.
Something wrong on this page?Report an issueEdit this page

On this page