Tools
The Tools menu (in the toolbar) gathers database-wide utilities.
Data Transfer
Requires Premium
Copy tables — schema and rows — from one database to another, even across connections and engines (ElyraSQL ↔ SQLite).
- Tools → Data transfer…
- Pick a Source (connection + database) and a Target (connection + database). The target connects automatically if needed.
- Choose All tables or Selected (tick the tables you want).
- Options:
- Create tables if missing — builds each target table from the source's columns and primary key.
- Empty target tables first — clears existing rows before copying.
- Transfer — a per-table report shows rows copied (and any errors).
Note
Secondary indexes and foreign keys are not reproduced (columns + primary key only). Rows are streamed in batches.
Schema diff & migration
Requires Premium
Compare two databases' schemas and get the migration that makes the
target match the source, as a pair: up, and the down that undoes
it. It is checked against the target's rows before you run it. Typical use:
dev is the source, staging or production the target.
- Tools → Schema diff & migration…
- Pick a Source and a Target (connection and database).
- Compare. The Changes tab lists every difference. up.sql and down.sql show the scripts.
- Then do one of these:
- Save pair writes
NNNN_name.up.sqlandNNNN_name.down.sqlinto your migrations folder, numbered one past the highest there (0042_…after0041_…). The folder is remembered. - Open in editor puts
up.sqlin a query tab, without running it. - Apply to target runs
up.sqlon the target, statement by statement, stopping at the first that fails. Production asks first. Afterwards the diff runs again, and should be empty.
- Save pair writes
What is compared
Tables, columns, primary keys, indexes (unique, full-text, spatial), CHECK
constraints, foreign keys and views.
- Read in the server's own words, from
SHOW CREATE TABLE(ElyraSQL, MySQL, MariaDB) orsqlite_masterandpragma_*(SQLite). What the migration writes keeps the source's defaults, collations andON DELETE. - Columns are matched by name. Indexes, constraints and foreign keys are
matched by what they are: their kind, columns and references. An index the
server named for you (
orders_ibfk_1, ElyraSQL'sfk_o_0) is the same index wherever it is called something else. If the target uses a name for a different index, that index is replaced. - Same meaning, different spelling, is not a difference: case outside
strings, spacing, an integer's display width (
int(11)isint),DEFAULT NULLon a nullable column. - Not compared: table options (
ENGINE,CHARSET),AUTO_INCREMENTcounters and triggers.
Both sides must be the same kind of database. ElyraSQL, MySQL and MariaDB count as one kind. To copy tables between SQLite and a server, use Data Transfer.
The scripts
up.sql runs top to bottom in this order:
- Foreign keys and indexes that go are dropped.
- New tables are created, without their foreign keys.
- Columns are added (
AFTERthe column before them, as in the source), changed and dropped. - Indexes are added.
- Foreign keys are added, once every table they point at exists.
- Views are created or replaced.
down.sql is up.sql reversed, change by change.
The top of up.sql says what the checks found. On MySQL, MariaDB and
ElyraSQL each schema change commits by itself, so if one fails, the ones
before it stay applied.
Nothing is dropped unless you ask
A table, column, index, foreign key or view only the target has is listed
under Not in this migration and left alone. Tick Also drop what only the
target has to drop them too. A dropped column or table loses its rows: the
change is marked loses rows, Apply asks again, and down.sql recreates it
empty and says so.
Checked against the target's rows
With Check the new rules against the target's rows on (the default),
every up statement that adds a rule is tried against the rows already in
the target, read-only. That covers NOT NULL, a shorter VARCHAR, a
narrower integer, UNIQUE, and a primary or foreign key. Each gets one of
these results:
- passes
- fails: MySQL and MariaDB in strict mode refuse the statement.
- changes rows: values are cut, clamped or defaulted.
- leaves rows breaking it: ElyraSQL Server 1.12 accepts
NOT NULL,UNIQUEand foreign keys without checking the rows already there.
Each result comes with the count. See Will this ALTER fail on the rows already there? for the details. Fix the rows, compare again, then apply.
What a server cannot change
| Target | Not supported | Instead |
|---|---|---|
| SQLite | Changing a column, adding or dropping a primary key, foreign key or UNIQUE constraint in CREATE TABLE |
Rebuild the table. Indexes of their own, new columns, new tables and views work. |
| ElyraSQL Server 1.12 | Changing a primary key (DROP PRIMARY KEY) |
Rebuild the table |
These changes are listed as not supported, and nothing is generated for them.
Data Synchronization
Requires Premium
Make a target table's rows match a source table's, keyed by the primary key.
- Tools → Data synchronization…
- Pick a Source (connection + database + table) and a Target (connection + database).
- Optionally tick Delete target rows missing from source.
- Compare — see counts (inserts / updates / deletes) and the generated statements. Apply to target runs them in one transaction.
Note
Requires a single-column primary key. Both sides are diffed in memory, so very large tables (>100k rows) are declined.
Extract a slice
Requires Premium
Reproducing a problem usually needs the rows involved — one customer, their orders, the products on those orders — not the whole database. Copying them by hand breaks on the first foreign key. A slice follows the keys for you.
- Tools → Extract a slice…, or right-click a table → Extract a slice…
- Pick the table to start from, and a Where condition —
id = 4711,created_at >= '2024-01-01'. Empty takes the first rows. - Choose whether to include the rows that reference the starting rows.
- Choose the output and Extract.
What goes in. Every row that anything in the slice points at, always — and their parents in turn — so the slice loads without a broken key. With the option ticked, also the rows that point at the starting rows, and the rows that point at those: a customer's orders and the orders' lines. Children are followed only downwards from where you started, never back out through a shared parent — the products on Ada's orders come along, but not every other order line that mentions those products.
What comes out, in your Downloads folder:
- SQLite file — tables, primary keys, foreign keys and rows, ready to open. Open as connection… adds it to the sidebar.
- SQL INSERTs — parents before children, for loading into a database that already has the schema (a dev database with your migrations applied).
The source is only ever read. Nothing is written to any server.
Mask personal data
Tick Mask personal data to share a slice without the people in it — in a bug report, with a colleague, with an AI agent. The dialog proposes the columns that look personal from their names. Tick or untick each one, choose what it holds, and add any column the search missed:
| Kind | Becomes |
|---|---|
u3f9a1c07b2@ex.invalid |
|
| Phone, ID / card / account number | The same shape — length, punctuation, letters where letters were — with every digit and letter replaced, country code included |
| First, last, full name | A made-up name |
| Username | user_3f9a1c07b2 |
| Address | 482 Example Street |
| Birth date | Same year, another month and day, any time of day zeroed |
| IP address | 10.x.y.z, or fd00::… for IPv6 |
| Password, token, key | redacted-… |
| Free text | [redacted] |
Only kinds that fit the column's type are offered: an email does not go into an integer column.
The slice still holds together. Each value becomes a pseudonym under a key
made for this one slice, so the same value is the same pseudonym in every table
and row. Emails are matched without regard to case, as a case-insensitive
collation matches them. A masked column is masked together with every column a
foreign key links it to, even if you only ticked one of them, so keys still
join. A pseudonym is cut to fit a VARCHAR(n) column.
Keys stay one-to-one. Some kinds have few possible values — there are about a thousand made-up full names — so two people can get the same one. That is harmless in a column nothing joins on. In a primary key, a unique column or a foreign key it would merge rows, so there a collision is re-drawn. If a kind cannot keep the values apart at all (32 first names for a unique column of 40), the slice is refused, naming the column, and nothing is written.
It cannot be traced back. The key is thrown away when the slice is written,
so a pseudonym cannot be reversed, not even by trying known addresses, and two
slices cannot be linked by comparing them. With masking on, the .sql output
does not repeat your filter in its header either, since the filter is as likely
as anything to name the person.
When in doubt, nothing is written. The extraction is refused, not written unmasked, if a ticked column cannot be found, if a kind does not fit its column, or if two linked columns are given different kinds.
Masking is only as good as the column list
Columns are found by their names. Data in a column with an unexpected
name — phone numbers in contact, an email in login — is not proposed, so
read the list and add what it missed. Free-text columns (notes,
comments) are offered but not ticked, because masking them loses the
text; they often hold names and numbers. Values that identify someone only
in combination, such as a postcode with a birth year, are left as they are
unless you choose them. A shape-preserving pseudonym keeps one fact about
the original: whether it started with a zero.
Branches: change a slice, push it back
Requires Premium
A slice can be kept as a branch: a local copy to change freely, by hand in the grid or with scripts, and then send back to where it came from.
- Extract a slice… as a SQLite file, and tick Keep as a branch.
- Open as connection… and change what you need.
- Tools → Push a branch… Choose the branch and press Review changes. You see, per table, how many rows are new, changed and deleted, and the exact statements that will run on the source, in its own dialect.
- Push runs them in one transaction, with the production confirmation if the source is production. Afterwards the branch matches the source, so pushing again does nothing until you change something more.
Rows go back, not your scripts. A script tried on SQLite does not behave exactly as it would on ElyraSQL or MySQL, because types, collations and functions differ. So the script is never run against the source. What is pushed is the difference in rows, matched by primary key: each row inserted, each row deleted, and each row changed, with only the columns that changed. Review that list. It is where a script that did something different on SQLite shows up.
Nothing changes on the source that you did not change in the branch.
- Rows changed since. Every row about to be touched is read back from the source and compared with how it was when the branch was made. If someone has changed or deleted it there since, or a new row has taken its key, nothing is pushed and the row is named. The check runs when you review, and again inside the write transaction with the rows locked, so a change in between cannot slip through.
- One row per statement. Every
UPDATEandDELETEmust hit exactly the one row it names. If not, the whole push rolls back. - Cascades. A row you deleted may be referenced on the source by rows that were never in the branch. Deleting it there would cascade to them, empty their key, or be refused. If any such row exists, the push is refused and says how many.
- What you reviewed. The push runs exactly the statements you reviewed. If the branch or the source changed since, it asks you to review again.
- The right source. The branch records the source's engine, address, user and database. A connection that now points somewhere else is refused, and so is a table whose primary key has changed there.
Resolving a conflict
A row that changed on both sides is shown three ways, column by column: when branched, source now and branch. Columns changed on the source and in the branch are highlighted, and a column changed on both sides to different values is marked red: keeping yours there overwrites what the source has now.
Each row gets two choices, worded for what happened to it:
| What happened | Keep the source's | Keep yours |
|---|---|---|
| Changed here and on the source | Use the source's row — your change to it is dropped | Keep my change — merged: the columns you changed keep your values, the others take the source's |
| Changed here, deleted on the source | Accept the deletion | Insert my row again |
| Deleted here, changed on the source | Keep the source's row | Delete it anyway |
| Inserted here, the key now taken on the source | Use the source's row | Overwrite with mine — the columns that differ |
Use the source's rows for all resolves every conflict that way at once.
Resolving changes only the branch — the row and its record of how the source had it — never the source. The plan is then made again, so what a push would run is shown before anything does, and the check that the source has not moved since runs again at push time. A conflict that is not about one row — a cascade, or a key matching several rows — is listed but not resolvable this way.
Values are compared as the source itself renders them, so a DECIMAL that
SQLite stores as 249 and the source shows as 249.00 is not mistaken for a
change, and a DECIMAL key still finds its row. A key that SQLite cannot
store exactly, such as an unsigned BIGINT past its integer range, refuses the
branch when you make it.
Not pushed
- Tables without a primary key, since a changed row cannot be told from a new one.
- Tables whose columns you changed in the branch. Only rows are pushed, never schema.
- A masked slice cannot be a branch, because pushing it would write the pseudonyms over the real data.
- ClickHouse, which has no transactions to push in, and on MySQL and MariaDB a table whose engine is not transactional (MyISAM, MEMORY).
Cross-connection query
Requires Pro
Some questions span two systems: accounts in ElyraSQL, their events in ClickHouse. A cross-connection query answers them with no pipeline in between.
-
Tools → Cross-connection query… (or ⌘K).
-
Add a source for each part. A source is a name, a connection, a database, and one read in that connection's dialect. From a query tab… copies the SQL from an open tab.
-
Write the query below the sources. It is written in SQLite's dialect, and it refers to each source by name, as a table:
SELECT a.name, COUNT(*) AS errors FROM accounts a JOIN events e ON e.account_id = a.id WHERE e.kind = 'error' GROUP BY a.name -
Run. Each source runs on its own connection. The results are loaded into a temporary SQLite database, the query runs over them, and the file is deleted afterwards.
Sources are read in full. The grid shows at most 2,000 rows of a result,
and a join over a result that was cut short is wrong without any warning: the
rows that would have matched are simply missing. So each source is read in full,
up to 100,000 rows. A source that returns more refuses the run and names
the source. Narrow it with a WHERE, or aggregate it in its own query first.
Nothing is written. Every source must be one read, and runs read-only on
its server: a read-only transaction on ElyraSQL, MySQL and MariaDB,
query_only on SQLite, readonly=2 on ClickHouse. The query over them must be
a read too. Numbers join across engines whatever each one calls them, so a
ClickHouse UInt64 matches a MySQL INT.
Data Generation
Requires Pro
Fill a table with plausible test data.
- Tools → Data generation…
- Pick the connection, database and table, and a row count.
- Generate.
A generator is inferred per column from its type and name — names, emails, country codes, dates, booleans, numbers — and a single integer primary key gets sequential values continuing after the current maximum. If you generate into the table you're browsing, the grid refreshes automatically.
Other tools
| Tool | What it does |
|---|---|
| Push a branch… | Send the rows changed in a branch back to its source (Premium) |
| Cross-connection query… | One query over the results of several others, on different connections (Pro) |
| Extract a slice… | Rows from one table plus everything their keys need, to a local file (Premium) |
| Data dictionary… | Dumps every object's CREATE statement into a new query tab (Pro) |
| Console | Opens a new query tab |
| Find in database… | Opens the command palette to jump to any table |
| Server monitor… | The live process list (Premium, ElyraSQL only) |
| History log | Your query history |