Skip to content

fix: take a relative database path from Python's current directory - #518

Merged
tae898 merged 3 commits into
mainfrom
fix/relative-database-path
Nov 27, 2026
Merged

tae898 merged 3 commits into
mainfrom
fix/relative-database-path

Conversation

@tae898

@tae898 tae898 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

A relative database path is now taken from Python's current directory, also after os.chdir. Before, the engine resolved a part of it against the directory it had started in.

After os.chdir Before Now
open_or_create_database("db"), then database_exists("db") False True
a second db from another directory while the first is open refused as already in use two databases
ArcadeDBServer(root_path="./server_root"), change directory, start fails to start starts, with the root of the directory where it was made

DatabaseFactory (and so create_database, open_database, open_or_create_database, and database_exists) and ArcadeDBServer make the path absolute before the engine sees it, in both packages. An absolute path is passed on unchanged. create_server already did this for its root, and import_documents and export_database already followed the current directory (their tests passed on the old code), so they are not changed.

Behaviour change: for a relative path, db.get_database_path() and the engine's error messages now show the absolute path. A factory or a server keeps the directory that was current when it was made.

Related issues

Closes #521

Performance changes

None.

Docs

agent-memory.adoc no longer asks for an absolute path after os.chdir, databases-and-queries.adoc states the rule and shows the new output, and upgrading.adoc lists the changed behaviour. The two changed output lines of the databases page are edited by hand: no test runs that page.

Checklist

  • A regression test fails on the old code and passes on the new (tests/test_relative_paths.py: at a7d444a, which holds only the tests, six of them failed on arcadedb-jvm with Python 3.14 and on arcadedb with Python 3.12; the pass is the checks of this pull request)
  • The test suite that the change can affect passes (the checks of this pull request)

The first run of the fix also showed that a Java string returned by getDatabasePath() was no longer accepted as a path; the second commit keeps it working.

  • uvx pre-commit run --files <changed files> passes

… directory

CI evidence first: the engine seems to resolve part of the files of a relative path against the directory it started in (FileManager opens component files by File.getAbsolutePath(), which reads the cached user.dir, while File.exists() and mkdirs() follow the process's current directory). These tests fail on the current bindings if that is so.
@tae898 tae898 added bug Something isn't working native The arcadedb package (native library build) jvm The arcadedb-jvm package (JPype build) labels Nov 27, 2026
@tae898 tae898 self-assigned this Nov 27, 2026
The engine resolves a part of the files of a relative path against the directory it started in (Java reads user.dir once; DatabaseFactory.getNormalizedPath and FileManager use it) and the rest against the current directory of the process, so after os.chdir one relative path named two directories. CI showed it on both packages at a7d444a: six of the new tests failed. DatabaseFactory (both builds) and ArcadeDBServer now make the path absolute before the engine sees it; an absolute path is passed unchanged. get_database_path() and error messages therefore show the absolute path.

Closes #521
@tae898 tae898 changed the title A relative path after os.chdir names one directory fix: take a relative database path from Python's current directory Nov 27, 2026
The absolute-path step called os.fspath, which does not take a java.lang.String; test_arrow_vector_column_jvm reopens a database with the string that getDatabasePath() returned (6 failures on the JVM build in CI).
@tae898
tae898 merged commit fba3d8e into main Nov 27, 2026
24 checks passed
@tae898
tae898 deleted the fix/relative-database-path branch November 27, 2026 12:01
@github-actions github-actions Bot added this to the 26.12.1 milestone Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working jvm The arcadedb-jvm package (JPype build) native The arcadedb package (native library build)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A relative database path after os.chdir does not name the database in the current directory

1 participant