SQL edit history
Strata keeps a version history for every SQL snippet that lives in the artifact panel, so you can review changes, compare versions, and revert.
Where edit history lives
Edit history is per-snippet, inside the SQL workspace of the artifact panel.
- Open a chat that has a SQL artifact (Strata wrote a query into the workspace, or you edited one there).
- The artifact panel opens on the right with a header that shows the artifact title, a history button (a clock-rewind icon), a copy button, and a close button.
- Click the history button. The Edit history menu opens under it.
The menu lists the versions. Choosing one opens it as a comparison in the Code tab, in place of the editor.
What you see in the menu
- Original AI snippet — the very first version Strata wrote, labeled as the baseline. Always present once you have made any edit.
- Latest saved — the most recent saved version.
- Version 2, Version 3, … — older saved versions, numbered.
- …, by Strata — a version Strata made. When you ask Strata to change a query you have edited while it is open in the workspace, its new query is added to that query's history too, marked this way, so you can compare it with yours or go back. A new query Strata writes otherwise is a query of its own, with its own card.
- Each entry shows a relative timestamp like "5m ago" (the Original AI snippet shows "baseline") and what it changes against the editor:
+N −N against the editor, or The same as the editor.
The arrow keys move through the menu; Escape closes it and puts you back on the history button. A click outside closes it too.
Versions are per snippet, not a global timeline. If Strata is helping you with two different queries in the same conversation, each query has its own independent history.
Running a query you have not changed adds no version: only an edit does.
Comparing a version
- Choose a version in the menu.
- The Code tab shows a line-by-line comparison of that version with what is in the editor.
The bar at the top names the version and counts the lines added (+N) and removed (−N) against the editor. Inside the comparison:
- Green lines prefixed with
+are present in the current editor but not in the selected version. - Red lines prefixed with
−are present in the selected version but not in the current editor. - White lines are unchanged.
The line-number gutters on the left of each diff row show the line numbers in each version so you can locate a change quickly.
Restoring a version
- Open the version you want in the comparison.
- Click Restore this version.
- The editor takes that version, line numbers and highlighting included, and the comparison closes.
Restoring saves that version as your newest edit; older versions are still kept, so you can go back again. Done closes the comparison without changing anything.
Your latest edit shown inline in chat
Your newest edit of a snippet is what its sql code block in the chat shows, and what its card opens, even after you refresh the page. A version Strata made stays in the history (marked by Strata); it is not shown in place of yours.
Reopening a query from its card
A query Strata puts in the workspace also leaves a card in its answer. The card opens your newest saved edit of that query, with Strata's original kept as the baseline in Edit history, so after a refresh you pick up where you left off. It is the same whether Strata opened the workspace while it was answering or you opened the query from its card.
Exporting query results as CSV
The Export CSV button lives on the result-set toolbar inside the workspace's Output tab, not on edit history. See /docs/chat/artifacts for that workflow.
What can go wrong
- No saved versions yet. A fresh conversation starts with an empty history. The original AI snippet becomes the baseline once you (or Strata) make any edit.
- Two snippets share a history. They do not — each snippet gets its own. If a version looks unfamiliar, you may be looking at the wrong snippet's history; close the layer, open the right workspace, then open history again.
- No Restore button. Restore this version is on the comparison, which opens when you choose a version in the menu. It is unavailable for a version that is the same as the editor.
Related
- /docs/chat/artifacts — the artifact panel and SQL workspace
- /docs/chat — main chat interface
- /docs/integrations/sql-server — connecting the database that powers the workspace