DataSource
DataSource manifests describe how bino loads raw data into the query engine.
Each datasource becomes a view named after metadata.name.
Name and SQL identifier
Section titled “Name and SQL identifier”metadata.name for DataSource must match the sqlIdentifier pattern
^([a-z_][a-z0-9_]*|@[a-z0-9][a-z0-9_-]*/[a-z0-9][a-z0-9_-]*)$, which allows two forms:
- A plain SQL identifier: lowercase letters, digits, and underscores only, starting with a letter or underscore (for example
sales_daily). - The
@scope/nameidentity of aDataSourcepulled from a bino registry (for example@acme/revenue-table).
Use the plain form directly in DataSet.spec.query. The @scope/name form has to be
double-quoted there, for example FROM "@acme/revenue-table".
Minimal definition
Section titled “Minimal definition”The smallest well-formed DataSource sets the required envelope, a metadata.name
that becomes the view name, the source type and the input that type needs. Every
remaining attribute is a tuning knob whose default or auto-detection fits most reports.
All attributes are listed in the Attribute Reference below.
The example above shows the csv variant. The alternatives are inline with
embedded rows (see Inline datasource), parquet with a
path (see Parquet files), excel with a path and an
optional sheet, and postgres_query / mysql_query with connection and
query (see PostgreSQL query and MySQL query).
Inline datasource
Section titled “Inline datasource”CSV files
Section titled “CSV files”CSV reader options
Section titled “CSV reader options”When the default auto-detection does not produce the right result, add CSV reader options to spec.
Any option that is set switches bino from read_csv_auto to read_csv with explicit parameters.
| Field | Type | DuckDB parameter | Description |
|---|---|---|---|
delimiter |
string | delim |
Field delimiter character (for example ";" or "|"). |
header |
boolean | header |
Whether the first row defines column names. Default true. |
skipRows |
integer | skip |
Number of lines to skip before reading data. |
thousands |
string | thousands |
Thousands separator in numeric values (for example "."). |
decimalSeparator |
string | decimal_separator |
Decimal point character (for example ","). |
dateFormat |
string | dateformat |
Date format using DuckDB strftime specifiers (for example "%d/%m/%Y"). |
columns |
object | columns |
Map of column name to DuckDB type. Mutually exclusive with columnNames. |
columnNames |
string[] | names |
Explicit column names. Mutually exclusive with columns. |
European number format
Section titled “European number format”Headerless CSV with typed columns
Section titled “Headerless CSV with typed columns”Custom column names
Section titled “Custom column names”Parquet files
Section titled “Parquet files”PostgreSQL query
Section titled “PostgreSQL query”MySQL query
Section titled “MySQL query”For more on secrets and object storage, see ConnectionSecret.
Sampling
Section titled “Sampling”The sample property lets you load only a subset of rows from a datasource using DuckDB’s USING SAMPLE clause. This is ideal for working with large datasets during preview and development, where you need fast iteration without waiting for millions of rows to load.
sample accepts three forms:
| Form | Example | DuckDB clause |
|---|---|---|
| integer | sample: 1000 |
USING SAMPLE 1000 |
| string | sample: "10%" |
USING SAMPLE 10% |
| object | sample: { size: 1000, method: reservoir } |
USING SAMPLE 1000 (reservoir) |
Sampling methods
Section titled “Sampling methods”When using the object form you can specify a method:
bernoulli- evaluates each row independently with the given probability. Good accuracy, works well for most datasets.system- samples entire vector chunks. Faster than bernoulli but higher variance, not recommended for small datasets (< 10k rows).reservoir- returns an exact number of rows. Only method that guarantees an exact count.
When no method is specified, DuckDB uses its default (system for percentages, reservoir for row counts).
Basic usage
Section titled “Basic usage”Percentage sampling
Section titled “Percentage sampling”Sampling with a specific method
Section titled “Sampling with a specific method”Sampling with constraints for development only
Section titled “Sampling with constraints for development only”Combine sample with constraints so the sampled datasource is used during preview and development, while the full dataset is used for production builds:
This pattern keeps bino preview fast and responsive while ensuring bino build always produces reports from the complete dataset.
Conditional inclusion with constraints
Section titled “Conditional inclusion with constraints”DataSource documents support metadata.constraints to conditionally include them for specific artefacts, modes, or environments.
Environment-specific data sources
Section titled “Environment-specific data sources”Use different data sources for development vs production:
Multiple environments with in operator
Section titled “Multiple environments with in operator”Match multiple environments at once using either format:
For the full constraint syntax and operators, see Constraints and Scoped Names.
Inline DataSource definitions
Section titled “Inline DataSource definitions”DataSources can also be defined inline within DataSet dependencies arrays, eliminating the need for separate documents. This is useful for simple, single-use data sources.
Example: Inline DataSource in a DataSet
Section titled “Example: Inline DataSource in a DataSet”The @inline(0) syntax references the inline DataSource by its position (0-indexed) in the dependencies array.
Supported types for inline definitions
Section titled “Supported types for inline definitions”All DataSource types can be used inline:
Multiple inline DataSources
Section titled “Multiple inline DataSources”Reference multiple inline DataSources by their index:
Mixing inline and named references
Section titled “Mixing inline and named references”You can combine inline definitions with references to standalone DataSource documents:
For more details on inline definitions and the @inline(N) syntax, see DataSet - Inline DataSet definitions.
Attribute Reference
Section titled “Attribute Reference”Common Metadata
Section titled “Common Metadata”All document kinds share these metadata fields.
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
apiVersion |
string | yes | - | Must be bino.bi/v1alpha1. |
kind |
string | yes | - | Must be DataSource. |
metadata.name |
string | yes | - | Unique identifier and name of the created view. Must match the sqlIdentifier pattern: a lowercase SQL identifier such as sales_daily, or a registry identity such as @acme/revenue-table. |
metadata.labels |
object | no | - | Key-value pairs for categorization and constraint matching. |
metadata.annotations |
object | no | - | Arbitrary key-value metadata, not used by the system. |
metadata.description |
string | no | - | Free-form description. |
metadata.constraints |
array | no | - | Conditional inclusion rules. See Constraints. |
Spec Attributes
Section titled “Spec Attributes”| Attribute | Type | Required | Default | Description | Sample |
|---|---|---|---|---|---|
spec.type |
string | yes | - | Data source type. Values: inline, excel, csv, parquet, postgres_query, mysql_query. |
type: csv |
spec.inline |
object | conditional | - | Inline data container holding a single content property. Required when type: inline and spec.content is not set. |
see below |
spec.inline.content |
array or string | yes | - | Inline rows as a YAML array of objects, or a JSON array encoded as a string. Required inside spec.inline. |
see below |
spec.content |
array or string | conditional | - | Inline data as a YAML array of objects or a JSON array encoded as a string. Required when type: inline and spec.inline is not set. |
see below |
spec.path |
string | conditional | - | File path, directory, glob pattern, or URL. Required when type is excel, csv, or parquet. |
path: ./data/*.csv |
spec.sheet |
string | no | first sheet | Worksheet name to read for type: excel. When omitted, the first worksheet is used. |
sheet: "Q1 2024" |
spec.connection |
object | conditional | - | Database connection details (no credentials). Required when type is postgres_query or mysql_query. |
see below |
spec.connection.host |
string | yes | - | Database server hostname or IP address. Required inside spec.connection. |
host: db.example.com |
spec.connection.port |
integer | yes | - | Database server port, 1-65535. Required inside spec.connection. |
port: 5432 |
spec.connection.database |
string | yes | - | Name of the database to connect to. Required inside spec.connection. |
database: analytics |
spec.connection.user |
string | yes | - | Username for database authentication. Required inside spec.connection. |
user: reporting |
spec.connection.schema |
string | no | public (PostgreSQL) |
Database schema name. | schema: public |
spec.connection.secret |
string | no | - | Name of a ConnectionSecret that holds the password. Its type must match the datasource type. |
secret: postgresCredentials |
spec.query |
string | conditional | - | SQL query executed against the remote database; its result populates the view. Required when type is postgres_query or mysql_query. |
query: SELECT * FROM sales |
spec.ephemeral |
boolean | no | derived from the source type | Controls caching between builds. When unset, database queries and remote URLs count as changing, inline content and in-project files as stable. Set to false to cache a remote or database source. |
ephemeral: false |
spec.sample |
integer, string, or object | no | - | Row sampling via DuckDB USING SAMPLE. An integer (≥ 1) samples rows, a string samples a percentage ("10%"), an object also picks the method. |
sample: 1000 |
spec.sample.size |
integer or string | yes | - | Number of rows (integer ≥ 1) or percentage ("10%") to sample. Required inside the object form. |
size: 10000 |
spec.sample.method |
string | no | DuckDB default (system for percentages, reservoir for row counts) |
Sampling method. Values: bernoulli, reservoir, system. |
method: reservoir |
spec.delimiter |
string | no | auto | CSV field delimiter (max 4 chars). | delimiter: ";" |
spec.header |
boolean | no | true |
Whether the first row defines column names (CSV only). | header: false |
spec.skipRows |
integer | no | 0 |
Number of lines to skip before reading data (minimum 0). |
skipRows: 2 |
spec.thousands |
string | no | - | Thousands separator in numeric values (max 1 char). | thousands: "." |
spec.decimalSeparator |
string | no | - | Decimal point character (max 1 char). | decimalSeparator: "," |
spec.dateFormat |
string | no | - | Date format using DuckDB strftime specifiers. | dateFormat: "%d/%m/%Y" |
spec.columnNames |
string[] | no | - | Explicit column names, at least one. For type: csv mutually exclusive with columns. |
columnNames: [date, region, amount] |
spec.columns |
object | no | - | Column name to DuckDB type mapping. For type: csv mutually exclusive with columnNames. |
see below |