Persisted views
CREATE VIEW compiles a relational FeatureQL query for every backend, then stores the compiled SQL as a read-only relation named FMV.schema.table. The view stores the compiled SQL. Each scan reads the current source data. SQL clients scan that relation; FeatureQL does not. VIEW_BACKENDS under Inspect lists the backends a view was compiled for. The artifacts are meant to compute the same FeatureQL result; Same answer across backends lists what the compiler rewrites and what still differs by engine.
Create a view
The name is exactly three identifiers and must start with FMV.. The body is any relational FeatureQL query — literals, persisted FM. features, KEYSETs, and physical tables. @(FEATURES IN …) is one body form, not a special path.
CREATE OR REPLACE VIEW FMV.DOCS.ORDERS AS
DEFINE
ORDER_ID := 101,
AMOUNT := 10
RETURN
ORDER_ID,
AMOUNT
;| message VARCHAR |
|---|
| ok |
The authored FeatureQL is stored. Metaprogramming (@(FEATURES IN …), @BIND_KEYSET) freezes only at create, replace, or recompile. Current table data is still read at scan time.
Scan it as SQL
A scan is an ordinary SQL SELECT, so the query endpoint reads it as SQL; add /* SQL */ to say so explicitly ( Language mode ). JDBC and Flight SQL are SQL by protocol.
SELECT
ORDER_ID,
AMOUNT
FROM fmv.docs.orders
;| ORDER_ID BIGINT | AMOUNT BIGINT |
|---|---|
| 101 | 10 |
A persisted view is not a FeatureQL source. FROM FMV.…, KEYSET SQL that names fmv.…, and EXTERNAL_COLUMNS / BIND_COLUMNS that name fmv.… raise UE/VIEW-NOT-A-FEATUREQL-SOURCE. Compose two views in SQL after substitution (/* SQL */ SELECT … FROM fmv.a JOIN fmv.b).
RETURN
amount
FROM FMV.DOCS.ORDERS
;Recompile and drop
RECOMPILE VIEW FMV.schema.table recompiles the stored body. It never materializes rows. Use it after you change a feature that the compiled snapshot depends on, or after @(FEATURES IN …) should pick up a newly persisted match.
DROP VIEW / DROP VIEW IF EXISTS removes the view feature. Failed replace or recompile leaves the prior artifacts in place.
Warnings
Create, replace, and recompile fail on compiler warnings unless the view body contains the usual ACK-XXXX comment — the same token FeatureQL prints as (acknowledge with ACK-XXXX). Acknowledgments never suppress errors. RECOMPILE VIEW recompiles that stored body, so the same comment still applies.
CREATE OR REPLACE VIEW FMV.DOCS.WARNED AS
-- ACK-MW54
DEFINE
X := 1e0
RETURN
FLAG := X > 0e0
;| message VARCHAR |
|---|
| ok |
See Tools in the query for how ACK-XXXX works on ordinary queries.
Inspect
DESCRIBE is the ordinary statement. FUNCTION is "VIEW". View-only fields are VIEW_* so they do not collide with feature PARAMS.
DESCRIBE (FIELDS (NAME, FUNCTION, VIEW_COLUMNS, VIEW_BACKENDS))
FMV.DOCS.ORDERS
;| OUTPUT FIELD VARCHAR | VALUE VARCHAR |
|---|---|
| [0].name | "FMV.DOCS.ORDERS" |
| [0].function | "VIEW" |
| [0].view_columns | ["ORDER_ID", "AMOUNT"] |
| [0].view_backends | ["duckdb", "trino", "serving", "postgres", "snowflake", "databricks", "bigquery", "clickhouse", "mysql"] |
SHOW FEATURES IN FMV.schema lists the view as a normal persisted feature.
Protection, briefly
Protection uses the compiled dependency snapshot, not the live graph and not authored @(). Drop or type-incompatible replace of a protected feature is refused (UE/VIEW-FEATURE-IN-USE, UE/VIEW-INCOMPATIBLE-FEATURE). Type-compatible replace is allowed; stored SQL stays until recompile. Bound INPUT / KEYSET / ENTITY stay in use (UE/VIEW-BINDING-IN-USE, UE/VIEW-KEYSET-IN-USE, UE/VIEW-ENTITY-IN-USE). An incompatible KEYSET entity or arity is UE/VIEW-INCOMPATIBLE-KEYSET.
Next
Point a SQL tool at the JDBC catalog , or read the full VIEW statement syntax . To compile the current feature definitions on each request instead of storing compiled SQL, use hybrid queries .