Working with SQL datasources
Fetch tables, define relationships, and build screens from SQL databases
Use this workflow after you connect a SQL datasource.
Connect the datasource
- Open the Data section
- Add a new source
- Choose your SQL provider
- Enter the connection details
- Fetch the tables you need
See the provider page for connection-specific setup:
Fetch tables
Fetch only the tables you need. This keeps the schema easier to manage and reduces setup later.
Define relationships
Add relationships for the joins you want to reuse in screens and bindings.
Use:
- One-to-many for foreign keys
- Many-to-many when you have a join table
If Budibase rejects a join table, fix the source constraints in the database and fetch the table again.
Build screens
Once the tables and relationships are ready, create autogenerated screens from the datasource.
Use them to:
- Browse related records
- Open detail or edit views
- Filter by selected values
- Reuse relationships in bindings and repeaters
Custom queries
Use a custom query when the data shape is easier to express in SQL than in the screen builder.
Custom queries are useful for:
- Flattening nested relationships
- Grouped or aggregated results
- Write workflows from a form action
- Returning a shape that is easier to bind in design
For read operations, select Read when you want to use the query with a data provider.
For write operations, use Execute Query from a form or button action.
Query bindings
Add bindings when the query needs dynamic values.
Use the query settings drawer to override defaults at runtime.
Related guides
Updated 4 months ago