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

  1. Open the Data section
  2. Add a new source
  3. Choose your SQL provider
  4. Enter the connection details
  5. 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


Did this page help you?