Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Your First Database Edits

In this tutorial, you’ll learn how to modify data in your database using Deflatable’s no-code interface. We’ll add new records, edit existing ones, and explore relationships between tables.

What You’ll Learn

Prerequisites

Starting Point

Launch Deflatable with the grocery database:

deflatable grocery.yaml

You should see the Aisle and Product tables.

Adding Your First Row

Let’s add a new aisle to the grocery store.

Step 1: Navigate to the Aisle Table

Make sure you’re on the “Aisle” tab. If not, press Tab or click on it.

Step 2: Press the Add Row Key

Press + (the plus key). You should see a modal window titled “Add Row to aisle”.

Step 3: Fill in the Fields

You’ll see input fields for each column:

Note: The Id field shows “(auto)” because this table uses auto-increment for its primary key. Some tables may require you to provide the primary key value manually (like UUIDs or composite keys).

Step 4: Submit the Form

Click the “Add Row” button or press Tab to focus it, then Enter.

The modal closes and you should see your new aisle (ID 4) appear in the table!

Understanding What Happened

When you submitted the form:

  1. Deflatable validated your input (checking that required fields were filled)

  2. Generated a SQL INSERT statement behind the scenes

  3. Executed it against your database

  4. Refreshed the table to show the new data

You never had to write SQL - Deflatable handled it all.

Now let’s add a product that references the aisle we just created. This demonstrates foreign key relationships.

Step 1: Switch to Product Table

Press Tab to switch to the “Product” tab.

Step 2: Open Add Row Form

Press + to open the add row modal.

Step 3: Notice the Foreign Key Field

Look at the “Aisle Id” field. Instead of a text input, you see a dropdown menu!

This dropdown shows:

Deflatable automatically:

Step 4: Fill in Product Details

Step 5: Submit

Click “Add Row” or tab to the button and press Enter.

Your new yogurt product appears in the table, and notice the “Aisle Id” column shows “Aisle 2” instead of just the number “2”.

Editing an Existing Row

Let’s say the price of milk changed. Here’s how to update it.

Step 1: Find the Milk Row

Use the arrow keys to navigate to the “Milk” row, or press / and search for “milk”.

Step 2: Open the Edit Form

With the cursor on the Milk row, press e (or double-click the row with your mouse).

A modal opens titled “Edit Row in product”.

Step 3: Notice the Differences

In edit mode:

Step 4: Change the Price

Tab to the “Price” field and change it from 3.49 to 3.99.

Step 5: Save Changes

Click “Save Changes” or press Enter.

The modal closes and the table updates to show the new price.

Working with Optional Fields

Some fields allow NULL values (they’re optional). Let’s see how this works.

Step 1: Add a Product Without an Aisle

Press + to add a new product:

Step 2: Submit

The product is added successfully even though it has no aisle relationship.

In the table, the “Aisle Id” column for this row will be empty, indicating NULL.

Common Mistakes and How to Avoid Them

Forgetting Required Fields

Try adding a product without a name:

  1. Press +

  2. Leave “Name” empty

  3. Set “Price” to 1.99

  4. Try to submit

You’ll get an error: “Missing required field: Name”

Required fields (marked NOT NULL in the database) must have values.

Invalid Data Types

Try entering text where a number is expected:

  1. Press +

  2. Enter “Name”: Test

  3. Enter “Price”: abc

  4. Try to submit

You’ll get an error about invalid data.

What You’ve Accomplished

Key Takeaways

No SQL Required: You modified database records without writing a single SQL query.

Foreign Keys Are Easy: Deflatable automatically creates dropdowns for relationships, showing meaningful names.

Validation Helps: The form validates your input before touching the database.

Primary Keys Protected: You can’t accidentally change a primary key when editing.

Next Steps

Now that you can add and edit data, try:

Practice Exercise

Try these on your own:

  1. Add 3 more products in different aisles

  2. Edit one of the aisles to change its length

  3. Add a product with no aisle assignment

  4. Find a product using search and update its price

The more you practice, the faster you’ll become at navigating and editing your databases!