sources

package
v1.146.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package sources provides concrete enrichment Source adapters for the platform's built-in sources (Trino, the platform catalog). Each adapter is a thin shim that satisfies the enrichment.Source interface and delegates to a caller-supplied client function so the underlying SDK version stays a detail of platform startup, not of this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogReader added in v1.146.0

type CatalogReader interface {
	GetDataset(ctx context.Context, ref catalog.Ref) (*catalog.Dataset, error)
	GetDefinition(ctx context.Context, ref catalog.Ref) (*catalog.Definition, error)
}

CatalogReader is what the catalog source reads from the platform catalog.

type CatalogSource added in v1.146.0

type CatalogSource struct {
	// contains filtered or unexported fields
}

CatalogSource exposes read-only platform catalog lookups for enrichment rules: a dataset with its columns and curation, and a glossary term, glossary node, tag, domain or data product.

A rule is operator policy and runs as the platform, the way the trino source runs the rule's SQL on the connection the rule names: it reads what the rule names, not what the calling persona reaches. An operator who binds a reference from a call's arguments decides that every caller of that tool may read the catalog entry it resolves to.

func NewCatalogSource added in v1.146.0

func NewCatalogSource(store CatalogReader) *CatalogSource

NewCatalogSource builds a source over the platform catalog.

func (*CatalogSource) Execute added in v1.146.0

func (s *CatalogSource) Execute(ctx context.Context, op string, params map[string]any) (any, error)

Execute dispatches the requested operation. Both read one parameter:

get_dataset     { reference string }  mcp:dataset:(kind,connection,path)
get_definition  { reference string }  mcp:glossary_term:<id or slug>, ...

func (*CatalogSource) Name added in v1.146.0

func (*CatalogSource) Name() string

Name returns the canonical source name "catalog".

func (*CatalogSource) Operations added in v1.146.0

func (*CatalogSource) Operations() []string

Operations returns the read-only operation allowlist.

type TrinoQueryFunc

type TrinoQueryFunc func(ctx context.Context, connection, sql string) ([]map[string]any, error)

TrinoQueryFunc executes a SQL query against a named Trino connection and returns the row set. Implementations are platform-side.

type TrinoSource

type TrinoSource struct {
	// contains filtered or unexported fields
}

TrinoSource exposes a single read-only "query" operation that runs a SQL template against a named Trino connection. The :name placeholders in the template are substituted with **escaped ANSI-SQL literals** derived from the binding values — single quotes are doubled, NULL is emitted for nil, ints/floats/bools are rendered as literals. This is not server-side parameter binding (the Trino Go client does not expose a parameterized exec path on our existing query interface); the escaping is sound for the supported value types but identifiers are not substitutable.

func NewTrinoSource

func NewTrinoSource(exec TrinoQueryFunc) *TrinoSource

NewTrinoSource builds a Source backed by the given query function.

func (*TrinoSource) Execute

func (s *TrinoSource) Execute(ctx context.Context, op string, params map[string]any) (any, error)

Execute runs the requested operation. Recognized parameters for "query":

connection    string  required — name of a configured Trino connection
sql_template  string  required — SQL with optional :name placeholders

Any additional parameters are treated as bindings and substituted into :<name> placeholders. Strings are single-quoted with embedded quotes doubled per ANSI SQL; numbers and bools are rendered as literals; nil becomes NULL. Other types are rejected.

func (*TrinoSource) Name

func (*TrinoSource) Name() string

Name returns the canonical source name "trino".

func (*TrinoSource) Operations

func (*TrinoSource) Operations() []string

Operations returns the read-only operation allowlist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL