This example demonstrates the Analyze API, which infers schema from CSV, NDJSON, or Parquet data.
cd examples/analyze
cp env.example .env
# Edit .env with your token
composer installphp index.phpThe example demonstrates:
| Method | Description |
|---|---|
analyzeContent() |
Analyze raw CSV/NDJSON/Parquet content |
analyzeRecords() |
Analyze PHP arrays as NDJSON |
analyzeUrl() |
Analyze a remote file by URL |
The Analyze API is useful for:
- Schema inference: Automatically detect column types from sample data
- Data Source creation: Generate schema for
.datasourcefiles - Data validation: Check if data matches expected types before ingestion
- Migration: Analyze existing files to create Tinybird Data Sources
Columns detected:
- date: Date
- product_id: String
- user_id: String
- event: String
- amount: Float32
Inferred Schema:
date Date, product_id String, user_id String, event String, amount Float32