Query from third-party clients
FeatureQL is the language of record. BI tools, SQL clients, notebooks and warehouses keep speaking SQL. This chapter is how those tools read FeatureQL features without a second, separate definition of the same logic.
There are two ways to expose features to a SQL tool, and both are integrations, not workarounds: the SQL tool reads the result of FeatureQL that the compiler has checked.
- Embed FeatureQL when your SQL tool should compile the current feature definitions on each request. A hybrid query puts
FEATUREQL(...)inside SQL, and the tool sees the island as a subquery or a CTE. BI tools that generate their own SQL around it and orchestrators that build tables from FeatureQL work this way. Business logic belongs inside the island, not in the SQL around it. - Publish a view when the tool needs a named relation. A persisted view is
CREATE VIEW FMV.schema.table ASa FeatureQL query. The view stores the compiled SQL. Each scan reads the current source data.
Once a view exists, tools that discover tables before they run SQL find it in the JDBC catalog : catalog fmv, TABLE_TYPE VIEW.
| Hybrid query | Persisted view | |
|---|---|---|
| What you author | FEATUREQL(...) inside SQL | CREATE VIEW FMV.schema.table AS a FeatureQL query |
| When FeatureQL compiles | On every request | Once, at create or RECOMPILE VIEW, for every backend |
| What a scan reads | The current source data | The current source data |
| Discovery | None: the SQL names the island | SHOW JDBC/* and JDBC metadata |
To store the rows of a query once, as an ordinary warehouse table, that is a separate choice: Writing tables . The FeatureQL body is the same on every engine when the compiler can rewrite SQL to match: see Backend compatibility .
Language mode
A query is SQL unless it carries FeatureQL. The query endpoint recognises FeatureQL statements (RETURN, DEFINE, CREATE FEATURES, SHOW FEATURES, a top-level :=, …) and treats an ordinary SQL SELECT as SQL. A comment directive overrides the detection:
/* SQL */ -- parse as SQL
/* FEATUREQL */ -- parse as FeatureQL To read a persisted view, send a SQL query such as SELECT ORDER_ID, AMOUNT FROM fmv.docs.orders. Add /* SQL */ to select SQL explicitly. JDBC and Flight SQL are SQL by protocol. A view is not a FeatureQL source: a FeatureQL query that reads FROM FMV.… raises UE/VIEW-NOT-A-FEATUREQL-SOURCE.
A hybrid query is SQL on the outside: the FEATUREQL(...) islands inside it do not make the whole query FeatureQL. Hybrid queries explains the syntax inside that SQL.
What this chapter is not
The opposite direction — SQL into FeatureQL — lives elsewhere:
- Mapping data sources pulls warehouse tables and configured serving sources into the feature graph.
- External JDBC is a serving source, not the catalog of persisted views.
CREATE FEATURES still persists FeatureQL definitions under FM.. A view persists a compiled SQL artifact under FMV.. You cannot store a /* SQL */ block as a feature.
Next
Start with hybrid queries if a SQL tool must wrap live FeatureQL. Start with persisted views if that tool should see an ordinary table. To have queries read values your own orchestrator precomputed with hybrid queries, follow Datakey caches .