CamusDB.Dump
0.9.3
See the version list below for details.
dotnet tool install --global CamusDB.Dump --version 0.9.3
dotnet new tool-manifest
dotnet tool install --local CamusDB.Dump --version 0.9.3
#tool dotnet:?package=CamusDB.Dump&version=0.9.3
nuke :add-package CamusDB.Dump --version 0.9.3
CamusDB Dump
camus-dump performs logical backups, producing a set of SQL statements that can be executed to reproduce the original CamusDB database definitions, indexes and table data
Installation
Install the camus-dump package from NuGet. Add it to your project in the normal way (for example by right-clicking on the project in Visual Studio and choosing "Manage NuGet Packages...").
Using .NET CLI
dotnet tool install --global CamusDB.Dump
Usage
# Everything in a database, to standard output
camus-dump --endpoint http://localhost:5096 --database mydb
# One table, 100 rows per INSERT, to a file
camus-dump -e http://localhost:5096 -d mydb -t orders -b 100 -o orders.sql
# A consistent snapshot of the whole database, replayable onto an existing schema
camus-dump -e http://localhost:5096 -d mydb --single-transaction --if-not-exists -o backup.sql
Restore by feeding the file back to any CamusDB SQL client, such as camussqlsh.
Connecting
| Option | Description |
|---|---|
-c, --connection-source |
Full connection string. Every option below fills in a key it does not already set. |
-e, --endpoint |
Server endpoint, or a comma-separated pool (default http://localhost:5096, the gRPC port). |
-d, --database |
Database to dump (default test). |
--protocol |
grpc (default) or rest. The server exposes each on its own port, so an endpoint given with -e has to match the protocol — REST against the gRPC port fails with an HTTP/1.x request was sent to an HTTP/2 only endpoint. |
--timeout |
Per-statement timeout in seconds (default 10). |
Authentication
CamusDB authentication is off by default. Against a server started with CAMUSDB_AUTH_ENABLED=true, pass credentials:
# Password from the environment — it never appears in the process list
CAMUSDB_PASSWORD=app-secret camus-dump -e https://camus.internal:5096 -d mydb -u app
# Prompt for it instead
camus-dump -e https://camus.internal:5096 -d mydb -u app --ask-password
# Or use a token minted elsewhere
camus-dump -e https://camus.internal:5096 -d mydb --access-token "camus_..."
| Option | Description |
|---|---|
-u, --user |
User to authenticate as. |
-p, --password |
That user's password. Prefer CAMUSDB_PASSWORD or --ask-password. |
-W, --ask-password |
Prompt for the password on the terminal. |
--access-token |
Bearer token obtained elsewhere, used instead of logging in. |
--token-lifetime |
Seconds to reuse a minted token when the server reports no expiry (default 600). |
The password is exchanged once for a short-lived bearer token, which the driver renews on its own; the password itself never travels with a statement. The dump only reads, so SELECT and SHOW privileges on the dumped tables are enough. With authentication enabled the server refuses credentials over plaintext outside loopback — use an https:// endpoint.
Authentication works the same over gRPC (--protocol grpc): the exchange rides the server's CamusAuth service on the channel that carries the statements, so no HTTP port has to be exposed just to obtain a token.
Choosing what to dump
| Option | Description |
|---|---|
-t, --table |
Dump only these tables (comma-separated, or repeat the option). |
-x, --exclude-table |
Skip these tables. |
-w, --where |
Dump only rows matching this condition. |
--no-create-table |
Do not emit CREATE TABLE. |
--no-data |
Do not emit INSERT. |
--no-indexes |
Do not emit the CREATE INDEX statements that follow each table. |
Shaping the output
| Option | Description |
|---|---|
-b, --batch |
Rows per INSERT statement (default 1). |
-o, --output |
Write to this file instead of standard output. |
--defer-indexes |
Emit each table's CREATE INDEX statements after its data rather than before. |
--add-drop-table |
Emit DROP TABLE IF EXISTS before each CREATE TABLE. |
--if-not-exists |
Emit CREATE TABLE IF NOT EXISTS, so the dump replays onto an existing schema. |
--create-database |
Emit CREATE DATABASE IF NOT EXISTS for the dumped database. |
--single-transaction |
Read every table from one lock-free serializable snapshot, so the dump is consistent across tables. |
--strict |
Fail instead of emitting NULL for a value that has no SQL literal (see below). |
--no-header |
Omit the leading comment header. |
Data types and indexes
Every type CamusDB stores is dumped as a literal that parses back to the same value: OID, STRING, INT64, FLOAT64, FLOAT32, BOOL, BYTES (as X'…'), DATE, DATETIME, UUID, ARRAY (as ARRAY[…]) and NULL.
Strings use CamusDB's two literal forms: the plain '…' form, which does no escape processing, for everything except values containing a control character, which use the E'…' escape form. Any string round-trips, including one holding a backslash, a trailing backslash, both quote characters, or a newline.
Indexes — unique, multi-column, and covering indexes with INCLUDE columns — are dumped both inline in CREATE TABLE and as separate CREATE INDEX IF NOT EXISTS statements, so a dump taken with --no-create-table still carries them, and --defer-indexes can build them after the rows have loaded. The IF NOT EXISTS makes the separate statements a no-op when the table definition already created the index.
One thing has no CamusDB SQL literal, and camus-dump reports it rather than emitting something that would restore incorrectly:
- Non-finite floats —
NaN,+Infinity,-Infinity. CamusDB's float literal has no form for them. The value is dumped asNULL.
It is counted and printed to standard error at the end of the run, and repeated as -- WARNING lines in the dump itself; --strict turns it into a failure instead. DATETIME values are truncated to milliseconds, the finest precision a CamusDB literal carries, and a dump that truncates one says so the same way.
Contribution
camus-dump is an open-source project, and contributions are heartily welcomed! Whether you are looking to fix bugs, add new features, or improve documentation, your efforts and contributions will be appreciated. Check out the CONTRIBUTING.md file for guidelines on how to get started with contributing to camus-dump.
License
camus-dump is released under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.