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 to open the Edit history layer over the panel.
The layer has two columns: a versions list on the left and a diff viewer on the right.
What you see in the versions list
- 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.
- Each entry shows a relative timestamp like "5m ago" (the Original AI snippet shows "baseline") plus a quick diff summary in the form
+N −N vs current: how many lines were added and removed compared to what is currently in the editor.
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.
Comparing a version
- Click any version in the list on the left.
- The right side shows a line-by-line diff between that version and what is currently in the editor.
The diff bar at the top of the right pane displays the count of additions (+N) and deletions (−N) along with a label like "5m ago → current" (the Original AI snippet reads "original → current"). Inside the diff:
- 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.
Reverting to a prior version
- Open the version you want to restore in the diff viewer.
- Click Revert to this at the top of the diff bar.
- The SQL workspace replaces its current contents with that version. Syntax highlighting refreshes.
Reverting saves your reverted version as the new latest — older versions are still kept, so you can re-revert if needed.
Latest edit shown inline in chat
The latest saved version of a snippet is reflected in the inline sql code blocks Strata writes into the chat transcript. That keeps the chat consistent with the workspace — what you see in the conversation is what the workspace currently has, even after you refresh the page.
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 Revert button. The Revert to this button only appears in the diff bar after you select a version in the list on the left. If the diff pane still reads "Select a version to compare with the current editor," click a version first.
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