Mock Statements
Mock Statements
Mock statements create temporary mock implementations of datasources or concepts for testing and development.
Syntax
mock_statement: "mock" SCOPE (IDENTIFIER ("," IDENTIFIER)*)?
Where SCOPE is one of: concepts, concept, datasources, datasource
Mock Datasources
Create mock data for a datasource:
mock datasource customers;
Mock Multiple
Mock multiple datasources at once:
mock datasources customers, orders, products;
Mock Concepts
Mock specific concepts:
mock concept customer.id, customer.name;
Use Cases
- Unit testing queries without database access
- Rapid prototyping
- Documentation examples
- CI/CD pipelines
Example
import customer as customer;
# Mock the customer datasource for testing
mock datasource customers;
# Now queries will use mock data
select
customer.id,
customer.name
;
Tips
Mock data is generated based on concept types - strings get placeholder text, numbers get sample values, dates get reasonable defaults.
