An agent proposes adding a note field to your orders table. The Lakebase schema diff shows the new column exactly where you expect it. The same patch also marks a pending order as shipped. Lakebase’s schema comparison shows changes to database definitions. To see whether the patch changed an order’s status, run the same query against the parent and the child. Azure Databricks branch management documentation
This tutorial is for a developer reviewing one SQL patch in an Azure Databricks Lakebase Postgres project. You’ll seed two synthetic orders, verify that a disposable child starts with the same schema and rows as its parent, and run two versions of the patch. The first gives you a specific reason to request changes. The second gives you an acceptance test for adding a nullable column while preserving both order statuses. All fixture outputs below are illustrative expected observations.
Databricks’ December 4, 2026 partner account describes teams using Lakebase branches on Azure Databricks to reproduce agent failures and test fixes before release. In this exercise, you control the starting data and know the expected outcome for each row before running either patch. Databricks partner account

Seed two orders on a sandbox parent
- Open the Lakebase App in your Azure Databricks workspace and select a Lakebase Postgres project with a writable sandbox parent for synthetic data. The example calls that branch
review-sandboxand usesdatabricks_postgres, the default database in a new project. Use your actual sandbox branch name if it differs. Lakebase quickstart - Confirm that you have project
CAN MANAGEpermission and that the sandbox branch can have children. In the Lakebase SQL Editor, select a Postgres role that can create the fixture table inpublic, insert and read its rows, and alter the table and update its rows on the child. The project permission lets you manage branches. The selected Postgres role determines which SQL operations you can perform. Branch management permissions · Lakebase SQL Editor - Open SQL Editor from the Lakebase App sidebar. Select
review-sandboxanddatabricks_postgres. Use a clean sandbox database where the fixture table name is available. Run theCREATE TABLEstatement, then run theINSERTafter table creation succeeds. Microsoft’s branch workflow seeds its starting table on the parent before creating the child. Branch-based development tutorial
CREATE TABLE public.lakebase_diff_orders (
order_id integer PRIMARY KEY,
status text NOT NULL
);
INSERT INTO public.lakebase_diff_orders (order_id, status)
VALUES (101, 'pending'),
(102, 'shipped');
The fixture uses a schema-qualified table name so every statement points to the same schema. The primary key gives you a stable identity for each order. Order 101 starts in the state the faulty patch will disturb. Order 102 starts in the state that the faulty patch assigns to 101. That pairing makes it easy to see why a check for the number of orders alone would miss the error. The task is to give both orders a place to store a future review note. Each existing order should keep its status and start with a SQL null in the new field.
If table creation reports an existing relation, stop before inserting and check the selected branch and database. You can continue an interrupted setup if you know you created that table for this exercise. Inspect its definition and run the ordered status query below. If the table has the intended definition and is empty, run the insert once. If it already contains the exact two fixture rows, continue to the baseline comparison. A duplicate key, an unfamiliar definition, or an unexpected row calls for investigation or a clean sandbox database. Use the same database name for every editor selection and comparison from that point forward.
Keep other sessions and application jobs from writing to the parent fixture during the exercise. A new child inherits its parent’s schema and data at creation. Subsequent parent changes stay on the parent until you take an action such as a reset. Schema diff reads the current definitions on both branches, so a parent edit after branching can change the comparison even if you have issued no new SQL on the child. Reset also takes the parent’s latest state. Lakebase branch semantics · Schema comparison and reset
Prove both branches start with the same fixture
- With the editor still targeting
review-sandbox, run the ordered query below and confirm the two results. Record the branch and database next to the output. Save this result before creating the child so you have an independent baseline to consult if the parent changes later. - In the project’s Branches list, select
review-sandbox, click Create child branch, and name the childreview-note-check. Choose Branch data and schema to start from the parent’s latest state, then create the branch. Verify that the child’s Parent entry points toreview-sandbox. Branch creation tutorial · Branch options and branch list - In SQL Editor, select
review-note-checkand the same database. Run the ordered query again and compare the entire result with the saved parent output. Both branches should show exactly101 pendingfollowed by102 shipped. Label the child output before switching the editor back to the parent. - Open the child overview. In Parent branch, click Schema diff. Set Base to
review-sandbox, Database todatabricks_postgres, and Compare toreview-note-check. Click Compare. Expect the message confirming the schemas are in sync. Record the selections so you can repeat the same comparison after each patch and after the reset. Schema diff controls
SELECT order_id, status
FROM public.lakebase_diff_orders
ORDER BY order_id;
ORDER BY order_id makes the output comparable one line at a time. Without an explicit sort, PostgreSQL leaves the result order unspecified. The query reads the entire fixture, so a missing 102 or an unexpected third order is visible alongside a change to 101. It names only columns that exist at every stage, which lets you run it unchanged when one branch has the new column and the other still has the original definition. PostgreSQL row ordering
If the child lacks the table or starts with different rows, verify when it was created, which branch it descended from, and whether you used the latest-state option. Check the editor’s database selector independently on each branch. If the rows match and the schemas differ, read both definitions to identify what moved. Start the patch review after the expected data and schema checks both pass. Identical outputs from two runs against the same branch would give you the wrong baseline, so preserve the target with each result.
Run the mixed patch and read both results
- Save the illustrative patch in review notes or keep the original file in version control. Before the first write, verify that the editor’s branch selector says
review-note-checkand the database saysdatabricks_postgres. The parent serves as the control after seeding. Verify the selectors again before the second write, especially if you switched branches to collect another result. - Run the
ALTER TABLEstatement on the child. Once it succeeds, run theUPDATEseparately on the same child. These two statements are the complete illustrative faulty patch. Separate runs let you associate each observation with a statement. For workspaces using Private Link with public access disabled, the editor’s stateless proxy also commits each statement independently, so a later failure can leave an earlier write in place. Lakebase SQL Editor execution and limitations - Repeat Schema diff with the same Base, Database and Compare selections. In the side-by-side DDL, look for
review_notewith typetextonpublic.lakebase_diff_orders. Inspect the surrounding definition for any other changes. Lakebase can highlight changes to a definition in both red and green, so read the text and identify the added column by name and type. How to read the schema diff - Run the ordered status query on the child and then on the parent. Expect
101 shipped,102 shippedon the child and101 pending,102 shippedon the parent. Record the difference with the exact patch revision while the evidence is still available on the child.
ALTER TABLE public.lakebase_diff_orders
ADD COLUMN review_note text;
UPDATE public.lakebase_diff_orders
SET status = 'shipped'
WHERE order_id = 101
RETURNING order_id, status;
The UPDATE targets the row with primary key 101. RETURNING reports the values from each updated row, so expect one result with 101, shipped. The follow-up SELECT shows the complete fixture after the patch, and its parent counterpart establishes the comparison value. If RETURNING produces zero rows, check the target and read back the fixture before drawing a conclusion. A successful statement that changed zero rows gives you a different observation from the expected faulty patch. PostgreSQL UPDATE and RETURNING
Both versions of the patch should yield the same column addition. The row readback changes the review decision. On the faulty child, 101 moves from pending to shipped, while 102 stays shipped. The two branches each still return two rows. Report the changed field and order ID so the author can identify the exact behavior to remove. The same review technique applies to a query result whose structure looks right while its values are wrong. Check the rows behind an agent-written join
Use the table to check each stage of task:lakebase-diff-01. The results are illustrative expectations for this fixture.
| Input | Action | Expected result |
|---|---|---|
task:lakebase-diff-01 baseline. Parent review-sandbox has 101 pending and 102 shipped. |
Create review-note-check from the latest parent state, run SELECT order_id, status FROM public.lakebase_diff_orders ORDER BY order_id; on both branches, and compare schemas. |
Schemas are in sync. Both results show exactly 101 pending, then 102 shipped. |
task:lakebase-diff-01 faulty patch. Add nullable review_note text and set 101 to shipped. |
Run the two patch statements on review-note-check, compare with Base review-sandbox, and run the ordered status query on both branches. |
The child adds review_note. The parent shows 101 pending and the child shows 101 shipped. 102 is shipped on both. Reject the patch. |
task:lakebase-diff-01 rejected patch saved outside review-note-check. |
Use Reset from parent on the child, then repeat the schema comparison and status query. | Schemas are in sync. Both results again show exactly 101 pending, then 102 shipped. |
task:lakebase-diff-01 corrected patch. Only ALTER TABLE public.lakebase_diff_orders ADD COLUMN review_note text;. |
Apply the corrected statement on the reset child. Repeat both checks and run the final child-only query. | The child adds only review_note. Both statuses match the parent, and both child rows have SQL NULL in review_note. Accept this rehearsal. |
Reset the child and restore the baseline
- Request changes on the original patch. For this fixture, the review comment would read, “The requested
review_notecolumn is present. Order101isshippedon the child andpendingon the parent. Remove the status update so the migration preserves both orders’ existing statuses.” Include the results from your own run. - Keep both original statements and the results outside the child. From Branches, open the menu for
review-note-check, choose Reset from parent, and confirm the target in the dialog. Reset completely overwrites the child’s data and schema with the parent’s latest state. Any other work on that child is lost, which is why the exercise uses a disposable branch dedicated to the fixture. Reset behavior and UI steps - After the operation finishes, reselect
review-note-checkand the database in SQL Editor. Reset can briefly interrupt connections. Rerun Schema diff from the child overview and run the ordered status query on both branches. Continue when the schemas are in sync and both outputs return exactly101 pending, then102 shipped.
A manual update to put 101 back to pending would leave the added column in place. The corrected ADD COLUMN needs the original table definition to exercise the same change. The reset restores the definition and the fixture rows together. Keeping the original SQL outside the branch also means the author and another reviewer can inspect the same revision after its database effects are gone. You Can’t Replay What You Can’t See
If the parent changed during the exercise, a reset can succeed without restoring the saved fixture. For example, both branches could now show 101 shipped and the schemas could still be in sync. Compare the current parent output with the saved pre-patch result, which requires 101 pending. If you can no longer establish the original conditions, repeat the setup on a clean synthetic parent before testing the correction. Lakebase parent-to-child reset semantics
Apply the corrected patch and verify the acceptance criteria
- Confirm that the new patch revision contains only the column addition below. In SQL Editor, verify the child and database selectors, then run the statement on
review-note-check. - Compare the child schema against
review-sandboxagain. Expect exactly the addition of nullablereview_note text, with no default or other DDL changes. Run the same ordered status query on both branches. Each should return exactly101 pendingand102 shipped. - On the child, run the final query below. Expect rows
101, pending, NULL, trueand102, shipped, NULL, true. Use the booleannote_is_nullto confirm SQL nulls even if the grid displays the note cells as blank.
ALTER TABLE public.lakebase_diff_orders
ADD COLUMN review_note text;
SELECT order_id,
status,
review_note,
review_note IS NULL AS note_is_null
FROM public.lakebase_diff_orders
ORDER BY order_id;
The shared query checks the existing fields using the same SQL on both branches. The child-only query checks the initial value of the new field. If the child query shows false for either order, inspect the value and the actual patch before accepting it. If the broader query succeeds on the parent, verify the editor target and inspect that branch’s definition to find out why review_note is available there. Lakebase SQL Editor branch and database selection
A filled review record for the illustrative corrected revision would read, “task:lakebase-diff-01, corrected column-only SQL, review-sandbox compared with review-note-check in databricks_postgres. DDL adds nullable review_note text only. Parent and child return 101 pending and 102 shipped. Both child notes are SQL NULL. Accepted on the synthetic fixture.” Attach the actual diff and query outputs in your own review and tie them to the corrected SQL revision. Deployment follows your team’s normal migration process. A required field on existing data has a different acceptance test, covered in the Aurora guide. Lakebase workflow and promotion · Aurora rehearsal for a NOT NULL migration
Diagnose a comparison that disagrees with the SQL
| What you see | What to verify before proceeding |
|---|---|
Schema diff shows the branches are in sync after the child’s ALTER TABLE. |
Check the editor branch and database used for the write. In Schema diff, independently check Base, Database and Compare. Inspect the child table with \d public.lakebase_diff_orders in the Lakebase SQL Editor. If both branches already have the field, investigate the baseline and where the write ran. |
| The new field appears on the Base side. | Confirm that Base is the parent and Compare is the child. Reversing these selections reverses the direction of the comparison. Read both table definitions to confirm which branch contains the field. |
The ALTER TABLE succeeds and the UPDATE fails. |
Preserve the error with the patch. Use a fresh schema comparison and the ordered status query to identify which effects persisted before resetting the child. |
| Reset from parent is unavailable or rejected. | Check the project permission, whether the selected branch has a parent, and whether it is protected or has children. If the original branch is blocked, use a new disposable child created from the same verified sandbox parent and check its baseline before applying the correction. |
| The status result is empty, has extra rows, or differs from the expected fixture after reset. | Verify the selected branch, database and Postgres role, then read the parent fixture again. If the parent still matches the saved result, keep the child error or output and verify reset completion before writing again. |
The editor’s \d meta-command describes a table. Enter \d public.lakebase_diff_orders by itself and click Run on each branch if you need to determine where the column exists. If one side returns a permission error, use the editor’s role selector to verify that you are using the intended role. If connections were interrupted during a reset, wait for it to finish and establish that the ordered read works on the selected child before running any write again. Editor meta-commands, roles and troubleshooting
The two checks cover the fixture and the selected database. For a patch that intentionally backfills data, decide which rows should change and which should stay fixed before executing it. If the task explicitly calls for shipping order 101, write that as an acceptance criterion and keep a second order whose status must be preserved. If the migration involves related tables, include readbacks for the affected records there. For a different way to build a controlled fixture and for the human review boundary, see these guides. Build synthetic test data on a Neon schema-only branch · AI PR Review Agent Policy
Before retiring the disposable child, keep the original patch, the reason for rejection, the corrected SQL and the actual final outputs together. If you remove the child, use its Delete branch menu item and confirm the exact name. Deletion permanently removes that child’s branch-specific changes and resources. The synthetic parent can serve as the baseline again if another reviewer needs to reproduce both decisions. Lakebase branch deletion
Sources
- Databricks Blog, How partners use Lakebase Postgres branching on Azure Databricks
- Microsoft Learn, Manage branches
- Microsoft Learn, Branches
- Microsoft Learn, Tutorial: Branch-based development workflow
- Microsoft Learn, Get a Postgres database
- Microsoft Learn, Query from Lakebase SQL Editor
- PostgreSQL documentation, UPDATE
- PostgreSQL documentation, Sorting Rows

