Common workflows

Tinybird Code excels at handling complex, multi-step workflows through natural language. Here are the most common patterns and examples.

Project Creation

Basic analytics project

Create a complete analytics project from a single prompt:

Create an analytics project for tracking user events with:
- A user_events table with user_id, event_name, timestamp, and properties
- An endpoint to get daily active users
- An endpoint for event counts by type

E-commerce project

Build an e-commerce analytics project with:
- Orders table: order_id, user_id, product_id, amount, timestamp
- Products table: product_id, name, category, price
- Daily revenue endpoint
- Top products by category endpoint

Real-time monitoring project

Create a monitoring project for application logs:
- Logs table with level, message, timestamp, service
- Error rate endpoint (errors per minute)
- Service health dashboard endpoint
- Alert endpoint for error spikes

Local development cycle

Set up local development for my project:
- Generate realistic mock data for all landing tables
- Test all endpoints in local with different parameters
- Show me the API URLs and example responses

Optimization Workflows

Performance analysis and optimization

Analyze my user_analytics endpoint performance. 
If it's reading more than 1GB, create a Materialized View to optimize it.
Also check if the Data Source needs better sorting keys.

Schema optimization

Review my events Data Source schema and optimize:
- Suggest better data types for compression
- Recommend optimal sorting keys for my query patterns
- Update the schema if improvements are significant

Query optimization

My dashboard endpoint is slow. Analyze the query and:
- Identify bottlenecks
- Create pre-aggregated Materialized Views if needed
- Update the endpoint to use optimized queries

Data Exploration Workflows

Monitoring and analytics

Show me project health and usage:
- Which endpoints are slowest?
- Which Data Sources have the most data?
- What are my top error patterns?
- Generate a project health report

Ad-hoc analysis

Analyze user behavior in my events Data Source:
- Show top 10 most common events last 7 days
- Break down events by user segment
- Identify usage trends over time
- Create visualization-ready endpoint

Performance investigation

Investigate slow queries in my workspace:
- List endpoints by average response time
- Show which Data Sources are being scanned most
- Identify candidates for Materialized Views
- Recommend optimization strategy
Updated