Data layer
Working with Views
Learn how to work with views in PandaAI
PandaAI 3.0 is currently in beta. This documentation reflects the latest features and functionality, which may evolve before the final release.
What are views?
Views are a feature of SQL databases that allow you to define logical subsets of data that can be used in queries. In PandaAI, you can define views in your semantic layer schema to organize and structure your data.
View configuration
The following sections detail all available configurations for view options in your schema.yaml
file. Similar to views in SQL, you can define multiple tables and the relationships between them.
Example Configuration
Constraints
-
Mutual Exclusivity:
- A schema cannot define both
table
andview
simultaneously. - If
source.view
istrue
, then the schema represents a view.
- A schema cannot define both
-
Column Format:
- For views:
- All columns must follow the format
[table].[column]
. from
andto
fields inrelations
must follow the[table].[column]
format.- Example:
parents.id
,children.name
.
- All columns must follow the format
- For views:
-
Relationships for Views:
- Each table referenced in
columns
must have at least one relationship defined inrelations
. - Relationships must specify
from
andto
attributes in the[table].[column]
format.
- Each table referenced in
Was this page helpful?