Import and export
- PostgreSQL
- MySQL
- MariaDB
- MongoDB
- Redis / Valkey
- Elasticsearch
- CLI
You can start a profile from a connection URI instead of typing each field, carry connections to
another machine in a passphrase-encrypted file, and bring in connections from the files other
tools write: an .ncx file, and two JSON files of MongoDB tools.
Fill a profile from a URI
Section titled “Fill a profile from a URI”- Open the New connection dialog: New connection in the side bar header’s menu (Connection actions).
- Paste the URI into Paste a URI to fill the form, under the engine cards. You do not need to pick the engine first: the URI names it.
- Choose Fill from URI, or press Enter. The dialog goes on to the form.
On the form, the URI button at the bottom shows the paste box again on the General tab, so you can fill an open form from a URI.
Querybara parses the URI and fills the engine, the endpoint, the user, the database, the TLS mode and the engine’s options. A password in the URI goes into the password field, set to Save in the OS keychain (or Remember for this session when no keychain is available). The name you typed and the environment, folder, colour and write guards stay as they are; with no name typed, Querybara names the connection after the host and database. Everything else comes from the URI: an SSH tunnel or a proxy set before is turned off.
The dialog confirms with “Filled from the URI”. Parameters Querybara does not use are listed after “Ignored:”.
| Engine | URI schemes |
|---|---|
| PostgreSQL | postgres://, postgresql://, jdbc:postgresql:// |
| MySQL | mysql:// |
| MariaDB | mariadb://, or mysql:// while MariaDB is the chosen engine |
| MongoDB | mongodb://, mongodb+srv:// |
| Redis | redis://, rediss://, redis+sentinel://, unix:// |
| Elasticsearch | http://, https:// |
TLS parameters in the URI set the TLS mode, and rediss://, https:// and mongodb+srv://
turn TLS on. A URI that says nothing about TLS leaves it off. See
TLS modes.
Save a profile from a URI on the command line
Section titled “Save a profile from a URI on the command line”querybara profiles add saves a profile under a name you choose. querybara profiles import-uri
names it after the host and database:
A password in the URI is saved only with --password-policy save and QUERYBARA_PASSPHRASE set;
see Passwords and keychain.
Export connections
Section titled “Export connections”- Open Export connections… in the side bar header’s menu (Connection actions), or run Export Connections… from the command palette.
- Tick the connections to export. All connections ticks or clears them all.
- Tick Include saved passwords to put the passwords, passphrases and tokens saved on this computer into the file.
- Type a passphrase in Passphrase and Repeat the passphrase.
- Choose Export… and pick where to save the file (
querybara-connections.qbxby default).
The file holds the connections and the folders above them, encrypted with AES-256-GCM under a key derived from your passphrase (scrypt). It cannot be opened without the passphrase, and the passphrase cannot be recovered. Saved passwords that cannot be read on this computer are left out, and the message after the export says how many.
Import connections
Section titled “Import connections”- Open Import connections… in the side bar header’s menu (Connection actions), or run Import Connections… from the command palette.
- Choose Choose file… and pick a Querybara export file, an
.ncxfile, or one of the JSON files of MongoDB tools. - For a Querybara export, or a file whose passwords are encrypted with a passphrase, type the passphrase and choose Open.
- Tick the connections to import. Each one shows its address, its folder and how many saved passwords the file holds for it.
- Choose Import.
Imported connections keep their folders. A connection that is already in the app shows Exists and is left alone; tick the Replace box under the list to overwrite them. A connection from a Querybara export matches by its id, so importing the same file twice never duplicates it.
Passwords in the file are saved in the OS keychain. Without a keychain they are not saved, and Querybara asks for them when you connect.
Connections from an .ncx file
Section titled “Connections from an .ncx file”Navicat exports connections with File > Export Connections, to an .ncx file. Querybara
reads it without a passphrase.
| What | Imported |
|---|---|
| Connection types | MySQL, MariaDB, PostgreSQL, MongoDB, Redis |
| Endpoint | Host and port, or the socket file of a MySQL connection |
| User and initial database | Yes |
| Saved passwords | Yes, saved in the OS keychain; unsaved ones are asked for |
| SSL | TLS mode, CA certificate, client certificate and key |
| SSH tunnel | Host, port, user; password, private key (with its passphrase) |
| HTTP tunnel, Windows named pipe | No: the connection imports without it, with a note |
A connection whose password Navicat did not save, or could not be read, comes in set to Ask every time. To keep its password, edit the connection and type the password: its storage switches to Save in the OS keychain (see Change a saved password).
Other connection types (Oracle, SQL Server, SQLite and so on) are listed under Not imported. A connection matches one already in the app with the same engine and name, so importing the file again offers to replace rather than duplicate.
For PostgreSQL, the SSL mode carries over (prefer becomes require, allow turns TLS off).
For MySQL and MariaDB, SSL with a CA certificate becomes verify-full, or verify-ca when the
connection allows an invalid host name; without one it becomes require.
Connections from MongoDB tools
Section titled “Connections from MongoDB tools”The dialog also reads two JSON files that MongoDB tools write. After you pick one, the dialog names it:
| The dialog shows | The file | Imported |
|---|---|---|
| MongoDB Compass connections | A connections export, a JSON file | Each connection string (read as a pasted URI is), the connection’s name and colour, and its SSH tunnel |
| Robo 3T connections | robo3t.json, the settings file, in ~/.3T/robo-3t/ under a version folder |
The host and port or the replica set’s members, the first enabled credential, the default database, SSH and TLS |
- Passwords that a connections export holds as they are come in with it. When the export encrypted them with a passphrase, the dialog asks for that passphrase first.
- Passwords that
robo3t.jsonholds as they are come in too. Passwords it holds encrypted with a key of the computer they were saved on cannot be read: the connection comes in set to ask for them when you connect, and its note says so. - Settings that are not kept are listed under the connection as notes, such as a proxy password, which Querybara asks for when connecting.
- Passwords from the file are saved in the OS keychain. Treat the file as a secret: anyone who has it can read them.
A connection matches one already in the app with the same engine and name, so importing the file again offers to replace rather than duplicate.
From the command line
Section titled “From the command line”The same files import and export from the command line. The passphrase of an export file comes
from QUERYBARA_EXPORT_PASSPHRASE, or the CLI asks for it.
# every profilequerybara profiles export profiles.qbx
# two profiles, with the saved secrets the CLI can readquerybara profiles export shop-profiles.qbx --profile shop-dev --profile shop-prod --include-secrets
# on the other machinequerybara profiles import shop-profiles.qbx
# connections exported from Navicatquerybara profiles import connections.ncx
# a MongoDB tool's settings filequerybara profiles import robo3t.jsonA connections export whose passwords are encrypted takes its passphrase from
QUERYBARA_EXPORT_PASSPHRASE too, or the CLI asks for it.
| Option | Command | What it does |
|---|---|---|
--profile <name> |
export |
Export this profile; repeat it for more. Without it, every profile is exported. |
--include-secrets |
export |
Add the saved secrets that are readable here. |
--replace |
import |
Replace profiles that already exist (same id, or same engine and name from another tool’s file). Without it, they are skipped with a warning. |
Imported profiles land in the store the desktop app uses, unless you point the CLI elsewhere with
--store or QUERYBARA_STORE.
Related
Section titled “Related”Documents Querybara 0.1.19 · built from89dc752