Pipe Types
The SDK supports five types of pipes:Endpoints
API-exposed pipes that return query results over HTTP
Internal Pipes
Reusable SQL transformations (not exposed as APIs)
Materialized Views
Continuously updated aggregations
Copy Pipes
Scheduled or on-demand data snapshots
Sink Pipes
Export data to external systems (Kafka, S3)
Endpoints
Endpoints are pipes exposed as HTTP API endpoints. UsedefineEndpoint() to create them:
~/workspace/source/src/schema/pipe.ts:766-823
Query Parameters
Define parameters using thep.* validators:
SQL Templates
Use Tinybird’s SQL templating syntax to inject parameters:Caching
Enable response caching for endpoints:Internal Pipes
Internal pipes are reusable SQL transformations that are not exposed as API endpoints:~/workspace/source/src/schema/pipe.ts:555-615
Nodes
Nodes are individual SQL query steps within a pipe. Each node can reference previous nodes:~/workspace/source/src/schema/pipe.ts:56-92
Materialized Views
Materialized views continuously update aggregations as new data arrives:~/workspace/source/src/schema/pipe.ts:690-763
Deployment Methods
By default, materialized views are recreated on deployment. Usealter to preserve data:
~/workspace/source/src/schema/pipe.ts:128-134
Copy Pipes
Copy pipes capture query results at a specific point in time and write them to a target datasource:~/workspace/source/src/schema/pipe.ts:825-904
Copy Modes
append(default): Appends results to the target datasourcereplace: Replaces all data in the target datasource
Copy Schedules
- Cron expression:
'0 * * * *'(hourly),'0 0 * * *'(daily) @on-demand: Manual execution only@once: Run once on deployment
Sink Pipes
Sink pipes export query results to external systems:Kafka Sink
~/workspace/source/src/schema/pipe.ts:617-655
S3 Sink
~/workspace/source/src/schema/pipe.ts:617-655
Output Schema
Define the output schema for type-safe query results:~/workspace/source/src/schema/pipe.ts:459-507
Access Control
Control pipe access with tokens:Related Resources
Datasources
Learn about table definitions and schemas
Type Inference
Extract types from pipe definitions
Parameter Validators
Complete reference of p.* validators
Connections
External connections for sink pipes