Upgrading to 26.12.1
Read this page before you move a program from 26.11.1, or from one of its post releases, to 26.12.1. It covers both packages, arcadedb and arcadedb-jvm. The changes of the engine itself are listed with the releases of ArcadeDB.
Changed behaviour
A write outside a transaction commits on its own
Before, such a write raised ArcadeDBError with "Transaction not begun" in the message. Now the statement runs in a transaction of its own and commits when it ends. This holds for every database that the packages hand out, the databases of an embedded server included.
-
Code that uses
with db.transaction():, ordb.begin()withdb.commit(), behaves as before. -
Code that relied on the error, for example to catch a write that is not in a transaction, must call
db.set_auto_transaction(False). The setting is not stored, so call it after every open. See Strict mode. -
A loop of single writes pays one commit for each of them. Put many writes in one transaction: see What a commit costs.
The text of an error starts with its code and a hint
str(e) of a failure that the packages recognize is [code] hint, followed by the text that the error had before.
-
Code that compares the whole text, or its beginning with
startswith, no longer matches. Teste.codeor the class of the error, or search the text within.e.to_dict()["message"]is the text without the code and the hint. -
A common cause raises a subclass of
ArcadeDBError, such asDuplicateKeyError.except ArcadeDBErrorstill catches it, buttype(e) is ArcadeDBErroris false. -
A failure with the code
unknownkeeps its class and its text.
NumPy is imported when it is first needed
import arcadedb no longer imports NumPy itself (arcadedb-jvm can still import it at that point through JPype). A NumPy that is installed but cannot be imported now raises at the first call that needs it. Before, the packages acted as if NumPy were not installed.
arcadedb writes text outside ASCII as it is in Result.to_json()
Before, arcadedb wrote every character outside ASCII as a \u escape. Now it writes the character itself, as arcadedb-jvm does, and keeps an escape only for control characters, U+2028 and U+2029. The parsed values are the same. Only the text, and so its length, its bytes and a hash of it, differs from what arcadedb returned before.
arcadedb stores a whole number from insert_many as arcadedb-jvm does
Before, arcadedb stored every whole number that insert_many wrote as a Long. Now it stores an Integer when the number fits 32 bits, also inside a list or a dict, and a Long beyond that, as arcadedb-jvm does. A property that the type declares keeps its declared type, the values that Python reads back are the same, and records that are already stored do not change. Code that asks for the stored type, for example with the SQL method type(), can see INTEGER where it saw LONG. See Bulk loads and commit size.
A conflict after a block committed part of its work raises PartialCommitError
Before, db.run_in_transaction(fn) and with db.transaction(): raised ConflictError when a block lost a conflict after a BATCH n boundary, or a commit() inside it, had stored part of its work. The hint said to run the transaction again, which applied that part a second time. Now they raise PartialCommitError with the code partial_commit, which is not a ConflictError.
-
Code that catches
ConflictErrorto retry no longer catches this case. CatchPartialCommitError, check what is stored, and decide what to run again. -
A block that committed nothing behaves as before.
A relative path is taken from the current directory
Before, a relative database path, or a relative root_path of ArcadeDBServer, did not name one directory once your program had changed its directory with os.chdir, because the engine resolved a part of the path against the directory in which it had started. For example, database_exists could answer False for a database that you had just created, and a second database with the same relative path in another directory was refused as already in use. Now both packages take a relative path from the current directory at the time of the call. db.get_database_path() and the error messages show the absolute path, also when you passed a relative one. See Databases and queries.
Engine 26.12.1
The engine that the 26.12.1 packages carry changes some behaviour that the other pages describe:
-
A vector index that
CREATE INDEX … LSM_VECTORmakes withoutaddHierarchyhas the HNSW hierarchy layers; on 26.11.1 and earlier it was a flat graph.create_vector_indexalready asked for the layers. See Vectors. -
A new
LSM_VECTORindex with more than 16,384 dimensions is refused, and so is the first vector of that length in an index that takes its dimensions from it. To create a wider index, first runALTER DATABASE `arcadedb.vectorIndex.maxDimensions` 20000, with the number that your vectors need. An index that is already stored keeps working. See The dimension limit. -
EXPORT DATABASErefuses a setting that it does not know and some values that it accepted before: see Importing and exporting data.
Keep a backup of the database directory before you upgrade. With the engine change ArcadeData/arcadedb#12239, a read-write open labels the database, and 26.11.1 then refuses to open it. The way to prevent the label is on Open a database with an older wheel.
New
-
open_or_create_database(path)opens the database when it exists and creates it when it does not: see Open or create. -
Every error has
code,hint,causeandto_dict(): see Errors: codes, hints and classes. -
Both packages ship type hints on every public class and function, and a
py.typedmarker (PEP 561). A type checker now reads them, so it can report problems in your code that it did not report before. -
The
FACETSclause and theCOLUMNARindex, which need engine 26.12.1: see Faceted queries.