Skip to content

Embedded BACKUP DATABASE writes to a fixed /backups/ directory and refuses a path; only db.export_database(path) works #345

Closed

Description

@tae898

I hit this while building a small service that keeps its state in an embedded ArcadeDB and needs a consistent backup of a database it holds open. On both wheels at 26.11.1 (native and JVM, same result) I could not make SQL BACKUP DATABASE write to a path I choose:

import arcadedb, tempfile, os
w = tempfile.mkdtemp()
db = arcadedb.create_database(os.path.join(w, "db"))
db.command("sql", "CREATE DOCUMENT TYPE T")
db.insert_many("T", [{"i": i} for i in range(10)])
db.command("sql", "BACKUP DATABASE file://" + os.path.join(w, "dump.zip"))
  • BACKUP DATABASE file:///some/path/dump.zip fails: Backup failed for database 'db' to directory '/backups/' (the target directory is a fixed /backups/, and the path is refused as an invalid file name).
  • BACKUP DATABASE /some/path/dump.zip is a SQL syntax error.
  • EXPORT DATABASE file:///some/path/e.jsonl.gz fails: Export file cannot contain path change because the directory is specified.
  • db.export_database(path, overwrite=True) works and writes a .jsonl.tgz; IMPORT DATABASE of that file into a new empty database restores types, properties, indexes, vertices and edges. I use that as the dump format for now.

A second process also cannot open a database that another process holds open, even read-only, so a backup has to come from the owning process.

Question: is there a setting that moves the backup directory in embedded mode (so BACKUP DATABASE <name> lands somewhere writable), or is the fixed directory intended for the server only? If it is a gap, I can add a Database.backup(path) to both bindings that wraps the engine call with a chosen directory, with a test that restores it, if that fits the maintainers' plan.

Activity

  1. added
    enhancement
    python
    on Nov 10, 2026
  2. added this to the 26.12.1 milestone on Nov 10, 2026
  3. tae898 commented on Nov 10, 2026

    @tae898
    CollaboratorAuthor

    I read the engine source of 26.11.1 for this. BACKUP DATABASE does not take its target from the statement: BackupDatabaseStatement takes the directory from the setting arcadedb.server.backupDirectory (scope JVM, default ${arcadedb.server.rootPath}/backups), and a comment there says the caller must not be able to change it, so that list backups, delete backup, restore backup and the retention policy see every backup (ArcadeData/arcadedb#7863). With no server bound, as in embedded mode, the global setting decides. arcadedb.server.rootPath has no default, which is how the directory became /backups/ in the run above. So the fixed directory is upstream's design, and the way to move it is that setting, not a path in the statement.

    What I have not tried: setting it from the wheels. On the JVM wheel it should be one JPype call on GlobalConfiguration.SERVER_BACKUP_DIRECTORY before the backup. On the native wheel I do not know whether an embedded database takes a global setting (the native server takes a settings dictionary, src/arcadedb/_native/server.py). Until that is tested, db.export_database(path) stays the supported dump for our own state, and I would not add a path argument for BACKUP DATABASE in the bindings, because that would work against the engine's rule.

    If someone needs the physical, zip-style backup in embedded mode, tell me here and I will test both routes and report the result.

  4. modified the milestones: 26.12.1, 27.1.1 on Nov 21, 2026
  5. tae898 commented on Nov 22, 2026

    @tae898
    CollaboratorAuthor

    I am closing this because the question is answered. BACKUP DATABASE takes its directory from the engine setting arcadedb.server.backupDirectory and not from the statement, which is the engine's design (ArcadeData/arcadedb#7863). Pointing that setting at a folder of my choice works on both wheels (I used it in the export and import study, #369), and #416 added a BACKUP DATABASE test for the native wheel. For a dump to a chosen path, db.export_database(path) is the simple route, so I am not adding a Database.backup(path).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementpython

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions