|
1 | 1 |
|
2 | | -# aerospike.Client.append |
3 | | - |
4 | | -aerospike.Client.append - Appends a string to the string value in a bin |
| 2 | +# aerospike.client.append |
5 | 3 |
|
6 | 4 | ## Description |
7 | 5 |
|
8 | 6 | ``` |
9 | | -status = aerospike.Client.append ( key, bin, value [, policies ] ) |
10 | | -
|
| 7 | +aerospike.client.append(key, bin, val[, meta[, policy]]) |
11 | 8 | ``` |
12 | 9 |
|
13 | | -**aerospike.Client.append()** will append a string *value* to the string value |
| 10 | +**aerospike.client.append()** will append a string *value* to the string value |
14 | 11 | in a *bin*. |
15 | 12 |
|
16 | 13 | ## Parameters |
17 | 14 |
|
18 | | -**key**, the key for the record. A tuple with keys |
19 | | -['ns','set','key'] or ['ns','set','digest']. |
20 | | - |
21 | | -``` |
22 | | -Tuple: |
23 | | - key = ( <namespace>, |
24 | | - <set name>, |
25 | | - <the primary index key>, |
26 | | - <a RIPEMD-160 hash of the key, and always present> ) |
27 | | -
|
28 | | -``` |
| 15 | +**key** the tuple (namespace, set, key) representing the key associated with the record |
29 | 16 |
|
30 | | -**bin**, the name of the bin. |
| 17 | +**bin** the name of the bin. |
31 | 18 |
|
32 | | -**value**, the string to append to the string value in the bin. |
| 19 | +**val**, the string to append to the string value in the bin. |
33 | 20 |
|
34 | | -**policies**, the dictionary of policies to be given while append. |
| 21 | +**meta** optional record metadata to be set. A dictionary with fields |
| 22 | +- **ttl** the [time-to-live](http://www.aerospike.com/docs/client/c/usage/kvs/write.html#change-record-time-to-live-ttl) in seconds |
35 | 23 |
|
36 | | -## Return Values |
37 | | -Returns an integer status. 0(Zero) is success value. In case of error, appropriate exceptions will be raised. |
| 24 | +**policy** optional write policies. A dictionary with optional fields |
| 25 | +- **timeout** write timeout in milliseconds |
| 26 | +- **key** one of the [aerospike.POLICY_KEY_*](http://www.aerospike.com/apidocs/c/db/d65/group__client__policies.html#gaa9c8a79b2ab9d3812876c3ec5d1d50ec) values |
| 27 | +- **gen** one of the [aerospike.POLICY_GEN_*](http://www.aerospike.com/apidocs/c/db/d65/group__client__policies.html#ga38c1a40903e463e5d0af0141e8c64061) values |
| 28 | +- **retry** one of the [aerospike.POLICY_RETRY_*](http://www.aerospike.com/apidocs/c/db/d65/group__client__policies.html#gaa9730980a8b0eda8ab936a48009a6718) values |
| 29 | +- **commit_level** one of the [aerospike.POLICY_COMMIT_LEVEL_*](http://www.aerospike.com/apidocs/c/db/d65/group__client__policies.html#ga17faf52aeb845998e14ba0f3745e8f23) values |
| 30 | +- **consistency_level** one of the [aerospike.POLICY_CONSISTENCY_LEVEL_*](http://www.aerospike.com/apidocs/c/db/d65/group__client__policies.html#ga34dbe8d01c941be845145af643f9b5ab) values |
| 31 | +- **replica** one of the [aerospike_POLICY_REPLICA_*](http://www.aerospike.com/apidocs/c/db/d65/group__client__policies.html#gabce1fb468ee9cbfe54b7ab834cec79ab) values |
38 | 32 |
|
39 | 33 | ## Examples |
40 | 34 |
|
41 | 35 | ```python |
42 | | - |
43 | 36 | # -*- coding: utf-8 -*- |
44 | 37 | import aerospike |
45 | | -config = { |
46 | | - 'hosts': [('127.0.0.1', 3000)] |
47 | | - } |
| 38 | +config = { 'hosts': [('127.0.0.1', 3000)] } |
48 | 39 | client = aerospike.client(config).connect() |
49 | 40 |
|
50 | | -key = ('test', 'demo', 1) |
51 | | - |
52 | | -options = { |
53 | | - 'timeout' : 5000 |
54 | | -} |
55 | | - |
56 | | -status = client.append( key, bin, value, options) |
57 | | - |
58 | | -print status |
59 | | - |
60 | | - |
61 | | -``` |
62 | | - |
63 | | -We expect to see: |
64 | | - |
65 | | -```python |
66 | | -0 |
| 41 | +try: |
| 42 | + key = ('test', 'demo', 1) |
| 43 | + client.append(key, 'name', ' jr.', policy={'timeout': 1200}) |
| 44 | +except Exception as e: |
| 45 | + print("error: {0}".format(e), file=sys.stderr) |
| 46 | + sys.exit(1) |
67 | 47 | ``` |
68 | 48 |
|
69 | | - |
70 | | - |
71 | 49 | ### See Also |
72 | 50 |
|
73 | | - |
74 | | - |
75 | | -- [Glossary](http://www.aerospike.com/docs/guide/glossary.html) |
76 | | - |
77 | 51 | - [Aerospike Data Model](http://www.aerospike.com/docs/architecture/data-model.html) |
| 52 | +- [Key-Value Store](http://www.aerospike.com/docs/guide/kvs.html) |
| 53 | + |
0 commit comments