aerospike
The Aerospike client enables you to build an application in Python with an Aerospike cluster as its database. The client manages the connections to the cluster and handles the transactions performed against it.
Data Model
At the top is the namespace
, a container that has one set of policy rules for all its data, and is similar to the database concept in an RDBMS, only distributed across the cluster. A namespace is subdivided into sets
, similar to tables.
Pairs of key-value data called bins
make up records
, similar to columns of a row in a standard RDBMS. Aerospike is schema-less, meaning that you do not need to define your bins in advance.
Records are uniquely identified by their key, and record metadata is contained in an in-memory primary index.
Architecture Overview and Aerospike Data Model for more information about Aerospike.
Serialization
Note
By default, the :pyaerospike.Client
maps the supported types :pyint
, :pystr
, :pyfloat
, :pybytearray
, :pylist
, :pydict
to matching aerospike server types (int, string, double, bytes, list, map). When an unsupported type is encountered, the module uses cPickle to serialize and deserialize the data, storing it into as_bytes of type 'Python' (AS_BYTES_PYTHON).
The functions ~aerospike.set_serializer
and ~aerospike.set_deserializer
allow for user-defined functions to handle serialization, instead. The serialized data is stored as 'Generic' as_bytes of type (AS_BYTES_BLOB). The serialization config param of aerospike.client
registers an instance-level pair of functions that handle serialization.
Note
Serialization Examples
The following example shows the three modes of serialization - built-in, class-level user functions, instance-level user functions:
from __future__ import print_function
import aerospike
import marshal
import json
def go_marshal(val):
return marshal.dumps(val)
def demarshal(val):
return marshal.loads(val)
def jsonize(val):
return json.dumps(val)
def dejsonize(val):
return json.loads(val)
aerospike.set_serializer(go_marshal)
aerospike.set_deserializer(demarshal)
config = {'hosts':[('127.0.0.1', 3000)]}
client = aerospike.client(config).connect()
config['serialization'] = (jsonize,dejsonize)
client2 = aerospike.client(config).connect()
for i in xrange(1, 4):
try:
client.remove(('test', 'demo', 'foo' + i))
except:
pass
bin_ = {'t': (1, 2, 3)} # tuple is an unsupported type
print("Use the built-in serialization (cPickle)")
client.put(('test','demo','foo1'), bin_)
(key, meta, bins) = client.get(('test','demo','foo1'))
print(bins)
print("Use the class-level user-defined serialization (marshal)")
client.put(('test','demo','foo2'), bin_, serializer=aerospike.SERIALIZER_USER)
(key, meta, bins) = client.get(('test','demo','foo2'))
print(bins)
print("Use the instance-level user-defined serialization (json)")
client2.put(('test','demo','foo3'), bin_, serializer=aerospike.SERIALIZER_USER)
# notice that json-encoding a tuple produces a list
(key, meta, bins) = client2.get(('test','demo','foo3'))
print(bins)
client.close()
The expected output is:
Use the built-in serialization (cPickle)
{'i': 321, 't': (1, 2, 3)}
Use the class-level user-defined serialization (marshal)
{'i': 321, 't': (1, 2, 3)}
Use the instance-level user-defined serialization (json)
{'i': 321, 't': [1, 2, 3]}
While AQL shows the records as having the following structure:
aql> select i,t from test.demo where PK='foo1'
+-----+----------------------------------------------+
| i | t |
+-----+----------------------------------------------+
| 321 | 28 49 31 0A 49 32 0A 49 33 0A 74 70 31 0A 2E |
+-----+----------------------------------------------+
1 row in set (0.000 secs)
aql> select i,t from test.demo where PK='foo2'
+-----+-------------------------------------------------------------+
| i | t |
+-----+-------------------------------------------------------------+
| 321 | 28 03 00 00 00 69 01 00 00 00 69 02 00 00 00 69 03 00 00 00 |
+-----+-------------------------------------------------------------+
1 row in set (0.000 secs)
aql> select i,t from test.demo where PK='foo3'
+-----+----------------------------+
| i | t |
+-----+----------------------------+
| 321 | 5B 31 2C 20 32 2C 20 33 5D |
+-----+----------------------------+
1 row in set (0.000 secs)
Logging
Geospatial
Operators for the multi-ops method :py~aerospike.Client.operate
.
Note
Beginning in version 3.4.0, it is recommended to use the operation helpers module aerospike_operation_helpers
To create the arguments for the :py~aerospike.Client.operate
and :py~aerospike.Client.operate
OPERATOR_WRITE
Write a value into a bin
{
"op" : aerospike.OPERATOR_WRITE,
"bin": "name",
"val": "Peanut"
}
OPERATOR_APPEND
Append to a bin with str
type data
{
"op" : aerospike.OPERATOR_APPEND,
"bin": "name",
"val": "Mr. "
}
OPERATOR_PREPEND
Prepend to a bin with str
type data
{
"op" : aerospike.OPERATOR_PREPEND,
"bin": "name",
"val": " Esq."
}
OPERATOR_INCR
Increment a bin with int
or float
type data
{
"op" : aerospike.OPERATOR_INCR,
"bin": "age",
"val": 1
}
OPERATOR_READ
Read a specific bin
{
"op" : aerospike.OPERATOR_READ,
"bin": "name"
}
OPERATOR_TOUCH
Touch a record, setting its TTL. May be combined with ~aerospike.OPERATOR_READ
{
"op" : aerospike.OPERATOR_TOUCH
}
OP_LIST_APPEND
Append an element to a bin with list
type data
{
"op" : aerospike.OP_LIST_APPEND,
"bin": "events",
"val": 1234,
"list_policy": {"write_flags": aerospike.LIST_WRITE_ADD_UNIQUE} # Optional, new in client 3.4.0
}
3.4.0
OP_LIST_APPEND_ITEMS
Extend a bin with list
type data with a list of items
{
"op" : aerospike.OP_LIST_APPEND_ITEMS,
"bin": "events",
"val": [ 123, 456 ],
"list_policy": {"write_flags": aerospike.LIST_WRITE_ADD_UNIQUE} # Optional, new in client 3.4.0
}
3.4.0
OP_LIST_INSERT
Insert an element at a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_INSERT,
"bin": "events",
"index": 2,
"val": 1234,
"list_policy": {"write_flags": aerospike.LIST_WRITE_ADD_UNIQUE} # Optional, new in client 3.4.0
}
3.4.0
OP_LIST_INSERT_ITEMS
Insert the items at a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_INSERT_ITEMS,
"bin": "events",
"index": 2,
"val": [ 123, 456 ]
"list_policy": {"write_flags": aerospike.LIST_WRITE_ADD_UNIQUE} # Optional, new in client 3.4.0
}
3.4.0
OP_LIST_INCREMENT
Increment the value of an item at the given index in a list stored in the specified bin
{
"op": aerospike.OP_LIST_INCREMENT,
"bin": "bin_name",
"index": 2,
"val": 5,
"list_policy": {"write_flags": aerospike.LIST_WRITE_ADD_UNIQUE} # Optional, new in client 3.4.0
}
3.4.0
OP_LIST_POP
Remove and return the element at a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_POP, # removes and returns a value
"bin": "events",
"index": 2
}
OP_LIST_POP_RANGE
Remove and return a list of elements at a specified index range of a bin with list
type data
{
"op" : aerospike.OP_LIST_POP_RANGE,
"bin": "events",
"index": 2,
"val": 3 # remove and return 3 elements starting at index 2
}
OP_LIST_REMOVE
Remove the element at a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_REMOVE, # remove a value
"bin": "events",
"index": 2
}
OP_LIST_REMOVE_RANGE
Remove a list of elements at a specified index range of a bin with list
type data
{
"op" : aerospike.OP_LIST_REMOVE_RANGE,
"bin": "events",
"index": 2,
"val": 3 # remove 3 elements starting at index 2
}
OP_LIST_CLEAR
Remove all the elements in a bin with list
type data
{
"op" : aerospike.OP_LIST_CLEAR,
"bin": "events"
}
OP_LIST_SET
Set the element val in a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_SET,
"bin": "events",
"index": 2,
"val": "latest event at index 2" # set this value at index 2,
"list_policy": {"write_flags": aerospike.LIST_WRITE_ADD_UNIQUE} # Optional, new in client 3.4.0
}
3.4.0
OP_LIST_GET
Get the element at a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_GET,
"bin": "events",
"index": 2
}
OP_LIST_GET_RANGE
Get the list of elements starting at a specified index of a bin with list
type data
{
"op" : aerospike.OP_LIST_GET_RANGE,
"bin": "events",
"index": 2,
"val": 3 # get 3 elements starting at index 2
}
OP_LIST_TRIM
Remove elements from a bin with list
type data which are not within the range starting at a given index plus val
{
"op" : aerospike.OP_LIST_TRIM,
"bin": "events",
"index": 2,
"val": 3 # remove all elements not in the range between index 2 and index 2 + 3
}
OP_LIST_SIZE
Count the number of elements in a bin with list
type data
{
"op" : aerospike.OP_LIST_SIZE,
"bin": "events" # gets the size of a list contained in the bin
}
OP_LIST_GET_BY_INDEX
Get the item at the specified index from a list bin. Server selects list item identified by index and returns selected data specified by return_type
.
{
"op" : aerospike.OP_LIST_GET_BY_INDEX,
"bin": "events",
"index": 2, # Index of the item to fetch
"return_type": aerospike.LIST_RETURN_VALUE
}
3.4.0
OP_LIST_GET_BY_INDEX_RANGE
Server selects count
list items starting at specified index and returns selected data specified by return_type. if count
is omitted, the server returns all items from index
to the end of list.
If inverted
is set to True
, return all items outside of the specified range.
{
"op" : aerospike.OP_LIST_GET_BY_INDEX_RANGE,
"bin": "events",
"index": 2, # Beginning index of range,
"count": 2, # Optional Count.
"return_type": aerospike.LIST_RETURN_VALUE,
"inverted": False # Optional.
}
3.4.0
OP_LIST_GET_BY_RANK
Server selects list item identified by rank
and returns selected data specified by return_type.
{
"op" : aerospike.OP_LIST_GET_BY_RANK,
"bin": "events",
"rank": 2, # Rank of the item to fetch
"return_type": aerospike.LIST_RETURN_VALUE
}
3.4.0
OP_LIST_GET_BY_RANK_RANGE
Server selects count
list items starting at specified rank and returns selected data specified by return_type. If count
is not specified, the server returns items starting at the specified rank to the last ranked item.
If inverted
is set to True
, return all items outside of the specified range.
{
"op" : aerospike.OP_LIST_GET_BY_RANK_RANGE,
"bin": "events",
"rank": 2, # Rank of the item to fetch
"count": 3,
"return_type": aerospike.LIST_RETURN_VALUE,
"inverted": False # Optional, defaults to False
}
3.4.0
OP_LIST_GET_BY_VALUE
Server selects list items identified by val
and returns selected data specified by return_type.
{
"op" : aerospike.OP_LIST_GET_BY_VALUE,
"bin": "events",
"val": 5,
"return_type": aerospike.LIST_RETURN_COUNT
}
3.4.0
OP_LIST_GET_BY_VALUE_LIST
Server selects list items contained in by value_list
and returns selected data specified by return_type.
If inverted
is set to True
, returns items not included in value_list
{
"op" : aerospike.OP_LIST_GET_BY_VALUE_LIST,
"bin": "events",
"value_list": [5, 6, 7],
"return_type": aerospike.LIST_RETURN_COUNT,
"inverted": False # Optional, defaults to False
}
3.4.0
OP_LIST_GET_BY_VALUE_RANGE
Create list get by value range operation. Server selects list items identified by value range (begin inclusive, end exclusive). If value_begin
is not present the range is less than value_end
. If value_end
is not specified, the range is greater than or equal to value_begin
.
If inverted
is set to True
, returns items not included in the specified range.
{
"op" : aerospike.OP_LIST_GET_BY_VALUE_RANGE,
"bin": "events",
"value_begin": 3, # Optional
"value_end": 6, Optional
"return_type": aerospike.LIST_RETURN_VALUE,
"inverted": False # Optional, defaults to False
}
3.4.0
OP_LIST_REMOVE_BY_INDEX
Remove and return the item at the specified index from a list bin. Server selects list item identified by index and returns selected data specified by return_type
.
{
"op" : aerospike.OP_LIST_REMOVE_BY_INDEX,
"bin": "events",
"index": 2, # Index of the item to fetch
"return_type": aerospike.LIST_RETURN_VALUE
}
3.4.0
OP_LIST_REMOVE_BY_INDEX_RANGE
Server remove count
list items starting at specified index and returns selected data specified by return_type. if count
is omitted, the server removes and returns all items from index
to the end of list.
If inverted
is set to True
, remove and return all items outside of the specified range.
{
"op" : aerospike.OP_LIST_REMOVE_BY_INDEX_RANGE,
"bin": "events",
"index": 2, # Beginning index of range,
"count": 2, # Optional Count.
"return_type": aerospike.LIST_RETURN_VALUE,
"inverted": False # Optional.
}
3.4.0
OP_LIST_REMOVE_BY_RANK
Server removes and returns list item identified by rank
and returns selected data specified by return_type.
{
"op" : aerospike.OP_LIST_REMOVE_BY_RANK,
"bin": "events",
"rank": 2, # Rank of the item to fetch
"return_type": aerospike.LIST_RETURN_VALUE
}
3.4.0
OP_LIST_REMOVE_BY_RANK_RANGE
Server removes and returns count
list items starting at specified rank and returns selected data specified by return_type. If count
is not specified, the server removes and returns items starting at the specified rank to the last ranked item.
If inverted
is set to True
, removes return all items outside of the specified range.
{
"op" : aerospike.OP_LIST_REMOVE_BY_RANK_RANGE,
"bin": "events",
"rank": 2, # Rank of the item to fetch
"count": 3,
"return_type": aerospike.LIST_RETURN_VALUE,
"inverted": False # Optional, defaults to False
}
3.4.0
OP_LIST_REMOVE_BY_VALUE
Server removes and returns list items identified by val
and returns selected data specified by return_type.
If inverted
is set to True
, removes and returns list items with a value not equal to val
.
{
"op" : aerospike.OP_LIST_REMOVE_BY_VALUE,
"bin": "events",
"val": 5,
"return_type": aerospike.LIST_RETURN_COUNT,
"inverted", # Optional, defaults to False
}
3.4.0
OP_LIST_REMOVE_BY_VALUE_LIST
Server removes and returns list items contained in by value_list
and returns selected data specified by return_type.
If inverted
is set to True
, removes and returns items not included in value_list
{
"op" : aerospike.OP_LIST_REMOVE_BY_VALUE_LIST,
"bin": "events",
"value_list": [5, 6, 7],
"return_type": aerospike.LIST_RETURN_COUNT,
"inverted": False # Optional, defaults to False
}
3.4.0
OP_LIST_REMOVE_BY_VALUE_RANGE
Create list remove by value range operation. Server removes and returns list items identified by value range (begin inclusive, end exclusive). If value_begin
is not present the range is less than value_end
. If value_end
is not specified, the range is greater than or equal to value_begin
.
If inverted
is set to True
, removes and returns items not included in the specified range.
{
"op" : aerospike.OP_LIST_REMOVE_BY_VALUE_RANGE,
"bin": "events",
"value_begin": 3, # Optional
"value_end": 6, Optional
"return_type": aerospike.LIST_RETURN_VALUE,
"inverted": False # Optional, defaults to False
}
3.4.0
OP_LIST_SET_ORDER
Assign an ordering to the specified list bin. list_order
should be one of aerospike.LIST_ORDERED
, aerospike.LIST_UNORDERED
.
{
"op": aerospike.OP_LIST_SET_ORDER,
"list_order": aerospike.LIST_ORDERED,
"bin": "events"
}
3.4.0
OP_LIST_SORT
Perform a sort operation on the bin. sort_flags
, if provided, can be one of: aerospike.LIST_SORT_DROP_DUPLICATES
indicating that duplicate elements should be removed from the sorted list.
{
'op': aerospike.OP_LIST_SORT,
'sort_flags': aerospike.LIST_SORT_DROP_DUPLICATES, # Optional flags or'd together specifying behavior
'bin': self.test_bin
}
3.4.0
OP_MAP_SET_POLICY
Set the policy for a map bin. The policy controls the write mode and the ordering of the map entries.
{
"op" : aerospike.OP_MAP_SET_POLICY,
"bin": "scores",
"map_policy": {"map_write_mode": Aeorspike.MAP_UPDATE, "map_order": Aerospike.MAP_KEY_VALUE_ORDERED}
}
OP_MAP_PUT
Put a key/value pair into a map. Operator accepts an optional map_policy dictionary (see OP_MAP_SET_POLICY for an example)
{
"op" : aerospike.OP_MAP_PUT,
"bin": "my_map",
"key": "age",
"val": 97
}
OP_MAP_PUT_ITEMS. Operator accepts an optional map_policy dictionary (see OP_MAP_SET_POLICY for an example)
Put a dictionary of key/value pairs into a map.
{
"op" : aerospike.OP_MAP_PUT_ITEMS,
"bin": "my_map",
"val": {"name": "bubba", "occupation": "dancer"}
}
OP_MAP_INCREMENT. Operator accepts an optional map_policy dictionary (see OP_MAP_SET_POLICY for an example)
Increment the value of map entry by the given "val" argument.
{
"op" : aerospike.OP_MAP_INCREMENT,
"bin": "my_map",
"key": "age",
"val": 1
}
OP_MAP_DECREMENT. Operator accepts an optional map_policy dictionary (see OP_MAP_SET_POLICY for an example)
Decrement the value of map entry by the given "val" argument.
{
"op" : aerospike.OP_MAP_DECREMENT,
"bin": "my_map",
"key": "age",
"val": 1
}
OP_MAP_SIZE
Return the number of entries in the given map bin.
{
"op" : aerospike.OP_MAP_SIZE,
"bin": "my_map"
}
OP_MAP_CLEAR
Remove all entries from the given map bin.
{
"op" : aerospike.OP_MAP_CLEAR,
"bin": "my_map"
}
Note that if "return_type" is not specified in the parameters for a map operation, the default is aerospike.MAP_RETURN_NONE
OP_MAP_REMOVE_BY_KEY
Remove the first entry from the map bin that matches the given key.
{
"op" : aerospike.OP_MAP_REMOVE_BY_KEY,
"bin": "my_map",
"key": "age",
"return_type": aerospike.MAP_RETURN_VALUE
}
OP_MAP_REMOVE_BY_KEY_LIST
Remove the entries from the map bin that match the list of given keys.
{
"op" : aerospike.OP_MAP_REMOVE_BY_KEY_LIST,
"bin": "my_map",
"val": ["name", "rank", "serial"]
}
OP_MAP_REMOVE_BY_KEY_RANGE
Remove the entries from the map bin that have keys which fall between the given "key" (inclusive) and "val" (exclusive).
{
"op" : aerospike.OP_MAP_REMOVE_BY_KEY_RANGE,
"bin": "my_map",
"key": "i",
"val": "j",
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_REMOVE_BY_VALUE
Remove the entry or entries from the map bin that have values which match the given "val" parameter.
{
"op" : aerospike.OP_MAP_REMOVE_BY_VALUE,
"bin": "my_map",
"val": 97,
"return_type": aerospike.MAP_RETURN_KEY
}
OP_MAP_REMOVE_BY_VALUE_LIST
Remove the entries from the map bin that have values which match the list of values given in the "val" parameter.
{
"op" : aerospike.OP_MAP_REMOVE_BY_VALUE_LIST,
"bin": "my_map",
"val": [97, 98, 99],
"return_type": aerospike.MAP_RETURN_KEY
}
OP_MAP_REMOVE_BY_VALUE_RANGE
Remove the entries from the map bin that have values starting with the given "val" parameter (inclusive) up to the given "range" parameter (exclusive).
{
"op" : aerospike.OP_MAP_REMOVE_BY_VALUE_RANGE,
"bin": "my_map",
"val": 97,
"range": 100,
"return_type": aerospike.MAP_RETURN_KEY
}
OP_MAP_REMOVE_BY_INDEX
Remove the entry from the map bin at the given "index" location.
{
"op" : aerospike.OP_MAP_REMOVE_BY_INDEX,
"bin": "my_map",
"index": 0,
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_REMOVE_BY_INDEX_RANGE
Remove the entries from the map bin starting at the given "index" location and removing "range" items.
{
"op" : aerospike.OP_MAP_REMOVE_BY_INDEX_RANGE,
"bin": "my_map",
"index": 0,
"val": 2,
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_REMOVE_BY_RANK
Remove the first entry from the map bin that has a value with a rank matching the given "index".
{
"op" : aerospike.OP_MAP_REMOVE_BY_RANK,
"bin": "my_map",
"index": 10
}
OP_MAP_REMOVE_BY_RANK_RANGE
Remove the entries from the map bin that have values with a rank starting at the given "index" and removing "range" items.
{
"op" : aerospike.OP_MAP_REMOVE_BY_RANK_RANGE,
"bin": "my_map",
"index": 10,
"val": 2,
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_GET_BY_KEY
Return the entry from the map bin that which has a key that matches the given "key" parameter.
{
"op" : aerospike.OP_MAP_GET_BY_KEY,
"bin": "my_map",
"key": "age",
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_GET_BY_KEY_RANGE
Return the entries from the map bin that have keys which fall between the given "key" (inclusive) and "val" (exclusive).
{
"op" : aerospike.OP_MAP_GET_BY_KEY_RANGE,
"bin": "my_map",
"key": "i",
"range": "j",
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_GET_BY_VALUE
Return the entry or entries from the map bin that have values which match the given "val" parameter.
{
"op" : aerospike.OP_MAP_GET_BY_VALUE,
"bin": "my_map",
"val": 97,
"return_type": aerospike.MAP_RETURN_KEY
}
OP_MAP_GET_BY_VALUE_RANGE
Return the entries from the map bin that have values starting with the given "val" parameter (inclusive) up to the given "range" parameter (exclusive).
{
"op" : aerospike.OP_MAP_GET_BY_VALUE_RANGE,
"bin": "my_map",
"val": 97,
"range": 100,
"return_type": aerospike.MAP_RETURN_KEY
}
OP_MAP_GET_BY_INDEX
Return the entry from the map bin at the given "index" location.
{
"op" : aerospike.OP_MAP_GET_BY_INDEX,
"bin": "my_map",
"index": 0,
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_GET_BY_INDEX_RANGE
Return the entries from the map bin starting at the given "index" location and removing "range" items.
{
"op" : aerospike.OP_MAP_GET_BY_INDEX_RANGE,
"bin": "my_map",
"index": 0,
"val": 2,
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
OP_MAP_GET_BY_RANK
Return the first entry from the map bin that has a value with a rank matching the given "index".
{
"op" : aerospike.OP_MAP_GET_BY_RANK,
"bin": "my_map",
"index": 10
}
OP_MAP_GET_BY_RANK_RANGE
Return the entries from the map bin that have values with a rank starting at the given "index" and removing "range" items.
{
"op" : aerospike.OP_MAP_GET_BY_RANK_RANGE,
"bin": "my_map",
"index": 10,
"val": 2,
"return_type": aerospike.MAP_RETURN_KEY_VALUE
}
2.0.4
Commit Level Policy Options
Specifies the number of replicas required to be successfully committed before returning success in a write operation to provide the desired consistency guarantee.
POLICY_COMMIT_LEVEL_ALL
Return succcess only after successfully committing all replicas
POLICY_COMMIT_LEVEL_MASTER
Return succcess after successfully committing the master replica
Consistency Level Policy Options
Specifies the number of replicas to be consulted in a read operation to provide the desired consistency guarantee.
POLICY_CONSISTENCY_ONE
Involve a single replica in the operation
POLICY_CONSISTENCY_ALL
Involve all replicas in the operation
Existence Policy Options
Specifies the behavior for writing the record depending whether or not it exists.
POLICY_EXISTS_CREATE
Create a record, ONLY if it doesn't exist
POLICY_EXISTS_CREATE_OR_REPLACE
Completely replace a record if it exists, otherwise create it
POLICY_EXISTS_IGNORE
Write the record, regardless of existence. (i.e. create or update)
POLICY_EXISTS_REPLACE
Completely replace a record, ONLY if it exists
POLICY_EXISTS_UPDATE
Update a record, ONLY if it exists
Generation Policy Options
Specifies the behavior of record modifications with regard to the generation value.
POLICY_GEN_IGNORE
Write a record, regardless of generation
POLICY_GEN_EQ
Write a record, ONLY if generations are equal
POLICY_GEN_GT
Write a record, ONLY if local generation is greater-than remote generation
Key Policy Options
Specifies the behavior for whether keys or digests should be sent to the cluster.
POLICY_KEY_DIGEST
Calculate the digest on the client-side and send it to the server
POLICY_KEY_SEND
Send the key in addition to the digest. This policy causes a write operation to store the key on the server
Replica Options
Specifies which partition replica to read from.
POLICY_REPLICA_SEQUENCE
Always try node containing master partition first. If connection fails and retry_on_timeout is true, try node containing prole partition. Currently restricted to master and one prole.
POLICY_REPLICA_MASTER
Read from the partition master replica node
POLICY_REPLICA_ANY
Distribute reads across nodes containing key's master and replicated partition in round-robin fashion. Currently restricted to master and one prole.
Retry Policy Options
Specifies the behavior of failed operations.
POLICY_RETRY_NONE
Only attempt an operation once
POLICY_RETRY_ONCE
If an operation fails, attempt the operation one more time
Auth Mode Constants
Specifies the type of authentication to be used when communicating with the server
AUTH_INTERNAL
Use internal authentication only. Hashed password is stored on the server. Do not send clear password. This is the default.
AUTH_EXTERNAL
Use external authentication (like LDAP). Specific external authentication is configured on server. If TLS defined, send clear password on node login via TLS. Throw exception if TLS is not defined.
AUTH_EXTERNAL_INSECURE
Use external authentication (like LDAP). Specific external authentication is configured on server. Send clear password on node login whether or not TLS is defined. This mode should only be used for testing purposes because it is not secure authentication.
SCAN_PRIORITY_AUTO
SCAN_PRIORITY_HIGH
SCAN_PRIORITY_LOW
SCAN_PRIORITY_MEDIUM
SCAN_STATUS_ABORTED
1.0.50 used by ~aerospike.Client.scan_info
SCAN_STATUS_COMPLETED
1.0.50 used by ~aerospike.Client.scan_info
SCAN_STATUS_INPROGRESS
1.0.50 used by ~aerospike.Client.scan_info
SCAN_STATUS_UNDEF
1.0.50 used by ~aerospike.Client.scan_info
1.0.39
JOB_SCAN
Scan job type argument for the module parameter of ~aerospike.Client.job_info
JOB_QUERY
Query job type argument for the module parameter of ~aerospike.Client.job_info
JOB_STATUS_UNDEF
JOB_STATUS_INPROGRESS
JOB_STATUS_COMPLETED
1.0.50
SERIALIZER_PYTHON
Use the cPickle serializer to handle unsupported types (default)
SERIALIZER_USER
Use a user-defined serializer to handle unsupported types. Must have been registered for the aerospike class or configured for the Client object
SERIALIZER_NONE
Do not serialize bins whose data type is unsupported
1.0.47
__version__
A str
containing the module's version.
1.0.54
null
A value for distinguishing a server-side null from a Python :pyNone
.
2.0.1 use the function aerospike.null
instead.
UDF_TYPE_LUA
INDEX_STRING
An index whose values are of the aerospike string data type
INDEX_NUMERIC
An index whose values are of the aerospike integer data type
INDEX_GEO2DSPHERE
An index whose values are of the aerospike GetJSON data type
INDEX_TYPE_LIST
Index a bin whose contents is an aerospike list
INDEX_TYPE_MAPKEYS
Index the keys of a bin whose contents is an aerospike map
INDEX_TYPE_MAPVALUES
Index the values of a bin whose contents is an aerospike map
LOG_LEVEL_TRACE
LOG_LEVEL_DEBUG
LOG_LEVEL_INFO
LOG_LEVEL_WARN
LOG_LEVEL_ERROR
LOG_LEVEL_OFF
Permission codes define the type of permission granted for a user's role.
PRIV_READ
The user is granted read access.
PRIV_READ_WRITE
The user is granted read and write access.
PRIV_READ_WRITE_UDF
The user is granted read and write access, and the ability to invoke UDFs.
PRIV_SYS_ADMIN
The user is granted the ability to perform system administration operations. Global scope only.
PRIV_USER_ADMIN
The user is granted the ability to perform user administration operations. Global scope only.
PRIV_DATA_ADMIN
User can perform systems administration functions on a database that do not involve user administration. Examples include setting dynamic server configuration. Global scope only.
Return types used by various map operations
MAP_RETURN_NONE
Do not return any value.
MAP_RETURN_INDEX
Return key index order.
MAP_RETURN_REVERSE_INDEX
Return reverse key order.
MAP_RETURN_RANK
Return value order.
MAP_RETURN_REVERSE_RANK
Return reserve value order.
MAP_RETURN_COUNT
Return count of items selected.
MAP_RETURN_KEY
Return key for single key read and key list for range read.
MAP_RETURN_VALUE
Return value for single key read and value list for range read.
MAP_RETURN_KEY_VALUE
Return key/value items. Note that key/value pairs will be returned as a list of tuples (i.e. [(key1, value1), (key2, value2)])
Return types used by various map operations
LIST_RETURN_NONE
Do not return any value.
LIST_RETURN_INDEX
Return key index order.
LIST_RETURN_REVERSE_INDEX
Return reverse key order.
LIST_RETURN_RANK
Return value order.
LIST_RETURN_REVERSE_RANK
Return reserve value order.
LIST_RETURN_COUNT
Return count of items selected.
LIST_RETURN_VALUE
Return value for single key read and value list for range read.
Flags used for the predexp.string_regex function
REGEX_NONE
Use default behavior.
REGEX_ICASE
Do not differentiate case.
REGEX_EXTENDED
Use POSIX Extended Regular Expression syntax when interpreting regex.
REGEX_NOSUB
Do not report position of matches.
REGEX_NEWLINE
Match-any-character operators don't match a newline.