Releases: arangodb/python-arango
5.2.0
- Fixed a bug where some of the outputs from ArangoDB were not formatted corrected.
- Added support for Replication API.
- Added support for Cluster API.
- Added new methods to WAL API.
5.1.0
5.0.0
Breaking Changes
-
Breaking changes to
arango.ArangoClient
:-
Replaced parameters
protocol
,host
andport
withhosts
andhost_resolver
. Example:from arango import ArangoClient # OLD client = ArangoClient(protocol='http', host='localhost', port=8529) # NEW (single host) client = ArangoClient(hosts='http://localhost:8529') # NEW (multiple hosts with "roundrobin" or "random" host resolver) client = ArangoClient(hosts=['http://host1:8529', 'http://host2:8529'], host_resolver='roundrobin')
-
Replaced properties
protocol
,host
,port
andbase_url
withhosts
. Example:from arango import ArangoClient # OLD client = ArangoClient(protocol='http', host='localhost', port=8529) client.protocol client.host client.port client.base_url # NEW client = ArangoClient(hosts='http://localhost:8529') client.hosts
-
-
Breaking changes to transactions:
- Changed the parameters in
Database.begin_transaction
. - Context managers are no longer offered (you must commit the transaction yourself).
- On API execution, results are now returned immediately instead of
TransactionJob
objects. - To abort transactions, you must call
TransactionDatabase.abort_transaction
method. - Removed exception
arango.exceptions.TransactionStateError
. - Removed exception
arango.exceptions.TransactionJobResultError
. - See examples here.
- Changed the parameters in
-
Breaking changes to
AQLQueryCache
(Database.aql.cache
):- Renamed parameter
limit
tomax_results
in methodAQLQueryCache.configure
. - Renamed field
limit
tomax_results
in the result of methodAQLQueryCache.properties
. - See examples here.
- Renamed parameter
-
Breaking changes to
arango.request.Request
:- Removed properties
read
,write
andcommand
. - The content of property
data
is no longer serialized.
- Removed properties
-
Removed method
Database.ping
(all it did was send a get API call which you can always do yourself). -
Changed the abstract class for custom HTTP clients (arango.http.HTTPClient). See new examples of defining your HTTP clients here.
New Features
- Python 3.7 is officially supported
- Added support for load balancing multiple hosts/coordinators in a cluster (available host resolving techniques are "roundrobin" or "random"). See API specification here.
- Added support for new transaction REST API.
- Added support for ArangoSearch views.
- Added support for analyzers.
- Added support for named indexes (new parameter
name
). - Added support for adding indexes asynchronously (new parameter
in_background
). - Added support for new TTL index.
- Added support for custom JSON serializers and de-serializers.
- Added new parameter
name_filter
to method Database.foxx.run_tests. - Added new method Collection.recalculate_count.
- Added new method Collection.responsible_shard.
- Added more fields in the result of method AQLQueryCache.properties and AQLQueryCache.configure.
4.4.0
4.3.0
- Added support for ArangoDB version 3.4.
- Added new method
db.status
. - Added new method
db.aql.entries
. - Changed the output format of
db.aql.functions
,db.aql.create_function
anddb.aql.delete_function
to account for ArangoDB 3.4 API changes. - Added new view management methods
db.views
,db.view
,db.create_view
,db.update_view
,db.replace_view
,db.delete_view
anddb.rename_view
. - Added new parameters
overwrite
,return_old
,return_new
to various document management methods.
4.2.1
4.2.0
- Removed the arbitrary default value of 100 for the
limit
parameter (now there is no threshold if it is not set) in following simple query methods:Collection.all
Collection.find
Collection.find_near
Collection.find_in_box
Collection.find_in_range
Collection.find_by_text
- Added support for ArangoDB version 3.3.9.
4.1.0
4.0.1
4.0.0
New Features
-
Manage documents using IDs (more examples here):
col.get('foo/bar') # Get by document ID col.get('bar') # Get by document key col.get({'_id': 'foo/bar'}) # Get by document body with ID col.get({'_key': 'bar'}) # Get by document body with key col.update({'_id': 'foo/bar', 'val': 1}) # Update by document ID col.update({'_key': 'bar', 'val': 1}) # Update by document key col.replace({'_id': 'foo/bar', 'val': 2}) # Replace by document ID col.replace({'_key': 'bar', 'val': 2}) # Replace by document key col.delete('foo/bar') # Delete by document ID col.delete('bar') # Delete by document key col.delete({'_id': 'foo/bar'}) # Delete by document body with ID col.delete({'_key': 'bar'}) # Delete by document body with key
-
Perform basic document operations directly from
Database
(more examples here):db.insert_document('students', {'_key': 'dave'}) db.has_document('students/dave') db.document('students/dave') db.update_document({'_id': 'students/dave', 'val': 1}) db.replace_document({'_id': 'students/dave', 'val': 2}) db.delete_document('students/dave')
-
Manage vertices and edges directly from
Graph
(more examples here):graph.insert_vertex('profs', {'_key': 'jon', 'name': 'Jon'}) graph.update_vertex({'_id': 'profs/jon', 'age': 35}) graph.replace_vertex({'_id': 'profs/jon', 'name': 'Jon', 'age':36}) graph.has_vertex('profs/jon') graph.vertex('profs/jon') graph.delete_vertex('profs/jon') graph.insert_edge('teach', {'_id': 'teach/1', '_from': 'profs/jon', '_to': 'lectures/CS101'}) graph.replace_edge({'_id': 'teach/1', '_from': 'profs/jon', '_to': 'lectures/CS101'}) graph.update_edge({'_id': 'teach/1', 'online': True}) graph.has_edge('teach/1') graph.edge('teach/1') graph.delete_edge('teach/1') graph.link('teach', 'profs/jon', 'lectures/CS101') graph.edges('teach', 'profs/jon', direction='out')
-
Executing a transaction now returns
TransactionJob
objects, allowing result retrieval after commit (see examples, restrictions and caveats here):with db.begin_transaction() as txn_db: txn_col = txn_db.collection('students') job1 = txn_col.insert({'_key': 'Abby'}) job2 = txn_col.insert({'_key': 'John'}) job3 = txn_col.insert({'_key': 'Mary'}) assert job1.result()['_id'] == 'students/Abby' assert job2.result()['_id'] == 'students/John' assert job3.result()['_id'] == 'students/Mary'
-
Added new methods to
Cursor
. MethodsCursor.pop
andCursor.fetch
lets you control when new batches are fetched from server. See here for details. -
Added new methods to
AQL
. See here for details. -
Added new methods to
Graph
. See here for details. -
Added new methods to
EdgeCollection
. See here for details. -
Added new method
Database.ping
. See here for details. -
Added support for Foxx. See here for details.
-
Improved error handling: the catch-all exception
ArangoError
now splits further intoArangoClientError
andArangoServerErrror
, allowing you to differentiate errors coming from server vs. client. Server exceptions, furthermore, give you access to HTTP request response metadata (e.g. status code, payload, headers). See here for details.
Non-Backward Compatible Changes
Unfortunately, many updates in 4.0.0 are not backward compatible. If you are upgrading, you will need to change your code in several places (sorry for the inconvenience).
High Level Changes
-
Some APIs were rather awkward and didn't make sense. For example,
ArangoClient
asks you for username and password before you specify the database. The initialization and the usage ofArangoClient
were made simpler and more intuitive. See here for examples. -
In previous versions of python-arango, attempt to abstract away ArangoDB's
_system
database did more harm than good. One example is the duplicated set of admin methods inArangoClient
andDatabase
. These admin methods are now accessible fromDatabase
only, and you must connect to_system
database explicitly. See here for examples. -
Some method names and signatures were modified for consistency. This is less likely to break your code if you were using keyword arguments over positional ones. Some examples are document management methods such as update, replace and delete. You should carry out a comprehensive review of all methods used in your code with new API specification.
-
Some modules were moved and/or renamed. Imports other than
from arango import ArangoClient
andfrom arango.exceptions import *
may not work anymore. Python-arango was designed such that the two imports are all you need for complete feature access. -
Some classes were renamed (e.g.
Database
toStandardDatabase
,Collection
toStandardCollection
). As long as you are not importing classes directly, this change alone should not break your code. Note thatStandardDatabase
andStandardCollection
are still referred to asDatabase
andCollection
in this changelog.
Databases
- User and access/permission management in python-arango was poorly designed (perhaps "broken" is the better word). It has been completely overhauled with new set of methods. Old methods such as
Database.grant_user_access
andDatabase.grant_revoke_access
were removed. See here for details. - Removed parameter
user
in methodDatabase.databases
(redundant). - Removed method
Database.sleep
(not supported by ArangoDB anymore). - Removed method
Database.execute
(not supported by ArangoDB anymore). - Removed parameter
names_only
in methodsDatabase.collections
,Database.graphs
andDatabase.users
(redundant).
Async Execution, Batch Execution and Transactions
- Renamed method
Database.async
toDatabase.begin_async_execution
. While rest of the API for async execution remains more or less the same, underlying class structures were overhauled. See here for details. - Renamed method
Database.batch
toDatabase.begin_batch_execution
. While rest of the API for batch execution remains more or less the same, underlying class structures were overhauled. See here for details. - Renamed method
Database.transaction
toDatabase.begin_transaction
. While rest of the API for transactions remains more or less the same, underlying class structures were overhauled. See here for details. - Removed parameter
commit_on_error
and methodclear
from batch execution and transactions. - Multiple commits using the same batch execution or transaction objects are not allowed anymore.
- Removed parameter
raise_errors
in methodsAsyncJob.result
andBatchJob.result
. Job exceptions are now always raised.
Collections and Documents
- All document revisions are now checked by default. In other words, all
check_rev
parameters in document management methods default toTrue
. - Method
Collection.unload
now returns a boolean. - Method
Collection.load
now returns a boolean. - Method
Collection.rename
now returns a boolean. - Method
Collection.truncate
now returns a boolean. - Method
Collection.checksum
now returns a string. - Removed parameter
inclusive
in methodCollection.find_in_range
. Now it is always inclusive on both ends. - Renamed parameter
offset
toskip
in methodCollection.find
. - Renamed parameter
offset
toskip
in methodCollection.find_in_range
. - Parameter
limit
now defaults to100
in methodsCollection.find
,Collection.find_near
,Collection.find_in_range
,Collection.find_in_box
andCollection.find_by_text
.
Graphs
- Changed the signature of method
Graph.create_edge_definition
, and ed...