Skip to content

Tables

Tables are the foundation of your app’s data layer. After connecting a database, you select which tables to import and configure how their fields behave within your application.

An App Table is a representation of a database table within EmberBlocks. When you import a table, EmberBlocks creates a configuration layer that lets you:

  • Rename fields for user-friendly display names
  • Hide fields that shouldn’t be visible in the app
  • Set defaults for new rows
  • Define computed values using formulas
  • Control editability of specific fields

The underlying database table remains unchanged - EmberBlocks only reads and writes data based on your configuration.

To import tables from a connected database:

  1. Navigate to the Data tab in your app
  2. Click Tables in the sidebar
  3. Click Add Tables button
  4. Select the connection (if you have multiple)
  5. Check the tables you want to import
  6. Click Import Selected
  • Start small: Import only the tables you need initially
  • Check row counts: Large tables may affect performance
  • Consider relationships: Import related tables together

After importing a table, click on it to configure its settings.

SettingDescription
Display NameThe name shown in the UI (can differ from the database table name)
EnabledWhether this table is active in your app

Each field in your table can be configured independently:

SettingDescription
Display NameUser-friendly name for the field
VisibleWhether the field appears in components
Read-onlyPrevents editing this field (useful for IDs, timestamps)
Default ValueStatic value for new rows
Default FormulaFormula evaluated when creating new rows
Computed FormulaFormula evaluated on create and update

EmberBlocks maps PostgreSQL data types to app-friendly types:

PostgreSQL TypeApp TypeUI Input
integer, bigint, smallintNumberNumber input
numeric, decimal, real, doubleDecimalDecimal input
varchar, text, charTextText input/textarea
booleanBooleanToggle/checkbox
dateDateDate picker
timestamp, timestamptzDateTimeDateTime picker
time, timetzTimeTime picker
json, jsonbJSONJSON editor
uuidUUIDText input (auto-generated)
byteaBinaryFile upload
Array typesArrayMulti-select/tags

Set default values for new rows using static values or formulas.

Simple fixed values:

Field TypeExample Default
Text"New Item"
Number0
Booleantrue
Date2024-01-01

Dynamic values evaluated at row creation:

-- Current user's email
{{$user.email}}
-- Current timestamp
NOW()
-- Auto-generated ID
CONCAT("ORD-", TEXT(NOW()))
-- Based on app context
{{$app.name}}

Computed fields automatically update their value whenever a row is created or modified.

Full Name Field:

CONCAT({{$row.first_name}}, " ", {{$row.last_name}})

Total Calculation:

{{$row.quantity}} * {{$row.unit_price}}

Status Based on Date:

IF({{$row.due_date}} < TODAY(), "Overdue", "Active")

Lookup from Related Table:

LOOKUP(categories, id = {{$row.category_id}}).name

Control which fields appear in your app:

Hide fields that are:

  • Internal IDs not meaningful to users
  • System fields (created_at, updated_at)
  • Sensitive data (passwords, tokens)
  • Join columns used only for relationships

Mark fields as read-only when:

  • They’re auto-generated (IDs, timestamps)
  • They’re computed by database triggers
  • Users shouldn’t modify them (audit fields)
  • They’re managed by external systems

Database schemas change over time. To sync EmberBlocks with your database:

  1. Go to the Data tab
  2. Click on the table
  3. Click Refresh Schema

EmberBlocks will:

  • Detect new columns and add them as fields
  • Identify removed columns (won’t delete automatically)
  • Update data types if changed

EmberBlocks automatically detects primary keys from your database schema. Primary keys are:

  • Used to identify rows for updates and deletes
  • Displayed with a key icon in field lists
  • Typically set as read-only

Tables with composite primary keys (multiple columns) are supported. All key columns will be marked and used for row identification.

EmberBlocks detects foreign key relationships for:

  • Display relationship indicators
  • Enable lookup formulas
  • Support relational queries

If orders.customer_id references customers.id:

-- Lookup customer name in an order context
LOOKUP(customers, id = {{$row.customer_id}}).name

Table access is controlled through your database connection credentials. EmberBlocks respects:

  • SELECT permission for reading data
  • INSERT permission for creating rows
  • UPDATE permission for editing rows
  • DELETE permission for removing rows

If a permission is missing, the corresponding action will fail with a clear error message.

For tables with many rows:

  • Enable pagination in List components
  • Use filters to limit data loaded
  • Index frequently queried columns in your database
  • Consider views for complex aggregations

For tables with many columns:

  • Hide unnecessary fields to reduce data transfer
  • Select specific columns when possible
  • Split into multiple views for different use cases

To remove a table from your app:

  1. Go to the Data tab
  2. Click the menu icon on the table
  3. Select Remove from App

The table is only removed from your EmberBlocks app - the actual database table is not affected.

  • Use clear, descriptive display names
  • Be consistent across your app
  • Consider your users’ vocabulary

Examples:

Database NameDisplay Name
cust_ordersCustomer Orders
inv_itemsInventory Items
usr_prefsUser Preferences
  • Order fields logically (most important first)
  • Group related fields together
  • Hide technical fields from end users
  • Use read-only for system-managed fields
  • Set appropriate default values
  • Use computed formulas for derived data

With your tables configured, you can: