Create features

Create one feature

Diagram(
Stack(
Sequence(
Terminal("CREATE FEATURE"),
Choice(0, Skip(), "OR REPLACE"),
Choice(0, Skip(), "TEMPORARY"),
Terminal("FEATURE"),
Choice(0, Skip(), "IF NOT EXISTS")
),
Sequence(
NonTerminal("feature_name"),
Choice(0, Skip(),
Sequence(Terminal("IN"), NonTerminal("namespace"), Choice(0, Skip(), Terminal("IF EMPTY")))
),
Terminal("AS"),
NonTerminal("expression")
)
)
)

This creates a persistent feature with the expression 1 + 5 that evaluates to 6.

Inspecting created features

Use SHOW FEATURES to view metadata about created features, including their data type and formula.

Using created features in queries

Once created, features can be referenced directly in SELECT statements and will evaluate using their stored definition.

Create many features

This example shows:

  • Input features: INPUT(BIGINT) requires explicit type declaration
  • Dependencies: Features can reference other features being created in the same statement
  • Complex expressions: CASE WHEN logic for conditional feature values
  • Automatic dependency resolution: FeatureQL computes features in the correct order

Alternative namespace syntax

You can use CREATE FEATURES IN to specify the target namespace:

This approach creates features directly in the specified namespace without needing fully qualified names.

Using multiple created features together

This demonstrates how created features can be:

  • Referenced directly (FM.TUTORIALS.CAD.FEATURE1)
  • Overridden locally (FM.TUTORIALS.CAD.FEATURE2 := 5)
  • Used in dependency chains that automatically update

Feature replacement and consistency

Successful feature replacement

When replacing features, FeatureQL maintains consistency by validating that the new definition is compatible with dependent features.

ALTER operations for metadata

Use ALTER FEATURE to modify feature metadata like descriptions without changing the feature's computational definition.

Last update at: 2025/10/13 10:23:46