Skip to main content

How to build a use case

Every Feldera use case has the same shape. Input connectors feed changes into SQL tables. SQL views compute the answers, and Feldera keeps them current on every change. Output connectors, queries or a change stream deliver the results. To build your use case, start from the example closest to it, then change the sources, the views and the outputs.

SourcesLakehouse, Kafka, CDCSQL tables and viewsone Feldera pipelineResultssinks, queries, change streamchangeschanges

Steps​

1. Run Feldera​

Run Feldera locally with Docker, or use the online sandbox. Install the fda CLI to manage pipelines from a terminal, a script or an agent.

2. Declare tables and connect sources​

A table declares the shape of an input. Its connectors property says where the data comes from. This table loads a Delta Lake table, then follows new versions of it:

CREATE TABLE orders (
order_id BIGINT NOT NULL PRIMARY KEY,
customer_id BIGINT,
status VARCHAR,
total DECIMAL(12, 2)
) WITH ('connectors' = '[{
"transport": {
"name": "delta_table_input",
"config": {"uri": "s3://lake/orders", "mode": "snapshot_and_follow"}
}
}]');

See all input connectors: Delta Lake, Iceberg, Kafka, PostgreSQL CDC, Debezium, S3, HTTP and more.

3. Write the logic as views​

Write the answers you need as SQL views. Views can use full SQL, build on each other, and be recursive. Declare a view MATERIALIZED to query it at any time:

CREATE MATERIALIZED VIEW revenue_by_status AS
SELECT status, COUNT(*) AS orders, SUM(total) AS revenue
FROM orders
GROUP BY status;

4. Send results out​

Attach output connectors to a view to write its changes to Kafka, Delta Lake, PostgreSQL, Redis and other destinations:

CREATE VIEW large_orders
WITH ('connectors' = '[{
"transport": {
"name": "kafka_output",
"config": {"bootstrap.servers": "broker:9092", "topic": "large-orders"}
},
"format": {"name": "json"}
}]')
AS SELECT * FROM orders WHERE total > 10000;

5. Deploy and start​

fda create my-pipeline program.sql
fda start my-pipeline

You can also use the web console, the Python SDK or the REST API (OpenAPI spec).

6. Read the results​

Query a materialized view:

fda exec my-pipeline "SELECT * FROM revenue_by_status"

Or subscribe to a view's changes over HTTP. With send_snapshot=true, you get the current contents first, then every change:

curl -X POST 'http://localhost:8080/v0/pipelines/my-pipeline/egress/revenue_by_status?format=json&send_snapshot=true'

Pick a starting point​

Each example below is a complete pipeline. Copy its SQL, then change the connectors and the views.

Use caseSourcesViewsResultsStart from
Agent contextAny mix of historical and live dataViews that the agent defines and deploys with fdaAd-hoc queries, HTTP change streamAgentic fraud detection
Fine-grained authorization (a graph use case)Users, groups, objects and relationship tuples from PostgreSQL CDC or KafkaRecursive views that resolve nested permissionsRedis, PostgreSQL or Kafka for fast lookupsStatic FGA, dynamic FGA, FGA guide
Other graphs: reachability, hierarchies, transitive closureNode and edge tables from any sourceRecursive viewsAny outputThe FGA examples, recursive queries
Real-time medallionBronze Delta Lake or Iceberg tablesSilver and gold viewsDelta LakeMedallion SQL, guide
Lakehouse batch jobsThe batch job's Delta Lake, Iceberg or S3 tablesThe job's SQL as viewsBack to the lakehouseBatch analytics SQL, guide
Streaming and CDCKafka, Debezium, PostgreSQL CDCViews of any complexityKafka, PostgreSQL, Redis, HTTPDebezium PostgreSQL, Debezium MySQL
Fraud detectionTransactions and reference data from Kafka and Delta LakeRolling-window featuresA model, or a feature storeFraud SQL, feature engineering SQL, guide

More complete pipelines: example SQL programs and runnable demos.

Coming from Spark SQL​

The felderize skill in Feldera Agent Skills translates Spark SQL to Feldera SQL. The batch jobs guide shows a full conversion.