Hi,
A very basic question/confirmation in Python.
In Spark if I want to send key to the set, I do the following:
spark.conf.set("aerospike.sendKey", true)
What is the equivalent of the above setting in Python client please?
config = {
'hosts': [(self.dbHost, self.dbPort)],
'policy': {'aerospike.POLICY_KEY_SEND': 'true', 'read': {'total_timeout': 1000}}
}
Is above correct please and I should be able to see it in AQL through
aql> set key_send true
KEY_SEND = true
aql> --set output json
aql> set record_print_metadata true
RECORD_PRINT_METADATA = true
aql> select * from test.oracletoaerospike2
+--------------+------------+-----------+--------------+------------------------------------------------------+-----------+--------+--------------------------------+----------------------+---------+-------+
| SMALL_VC | RANDOMISED | SCATTERED | PADDING | RANDOM_STRING | CLUSTERED | ID | {edigest} | {set} | {ttl} | {gen} |
+--------------+------------+-----------+--------------+------------------------------------------------------+-----------+--------+--------------------------------+----------------------+---------+-------+
| " 10" | "8.0" | "9.0" | "xxxxxxxxxx" | "InblvsVdzHVVPFElOsSWtRLkqAJwytraTSsWMoEaoYNAuAoIrI" | "0.0" | "10.0" | "mlCmGc4yuYN8dXpgAY1bvD4SM4g=" | "oracletoaerospike2" | 2587973 | 27 |
| " 5" | "31.0" | "4.0" | "xxxxxxxxxx" | "vDsFoYAOcitwrWNXCxPHzIIIxwKpTlrsVjFFKUDivytqJqOHGA" | "0.0" | "5.0" | "4kL+GIrLingKfKDNRb1MiS1Pdrw=" | "oracletoaerospike2" | 2587973 | 27 |
| " 1" | "63.0" | "0.0" | "xxxxxxxxxx" | "rMLTDXxxqXOZnqYRJwInlGfGBTxNkAszBGEUGELqTSRnFjRGbi" | "0.0" | "1.0" | "mFOCvMwz3qrt7kpY/2+u7Pmui34=" | "oracletoaerospike2" | 2587973 | 27 |
| " 2" | "926.0" | "1.0" | "xxxxxxxxxx" | "UEDJsfIgoYqwreSuuvjIcPZarpxMdCthpDCsgPlJfvIiylLiBS" | "0.0" | "2.0" | "QwYTCU5usJWwB4J/uwTnlEWGNRY=" | "oracletoaerospike2" | 2587973 | 27 |
| " 4" | "294.0" | "3.0" | "xxxxxxxxxx" | "HsLQJstfFDYSqtSIMfRDoLDpgfpxSqAQmToFMEwzmcqEIkHzmG" | "0.0" | "4.0" | "V8Y9JtXqNZpzqERzOcMcHJQTAjI=" | "oracletoaerospike2" | 2587973 | 27 |
| " 6" | "291.0" | "5.0" | "xxxxxxxxxx" | "yvOKszDuIKsHySzCCrQFyvIyJyWQDwZnPABkVnzNVMKgNxvsBH" | "0.0" | "6.0" | "oz2w8WA+1/XG3fWTrbPlG7Wjav0=" | "oracletoaerospike2" | 2587973 | 27 |
| " 7" | "391.0" | "6.0" | "xxxxxxxxxx" | "FCJNHulbvwdhXKusUFzPXEbmLtEqKFrWGFnvJlcgSQhkgHDASw" | "0.0" | "7.0" | "IQCwhQXCNC+8odHBC6U6JwgbUiE=" | "oracletoaerospike2" | 2587973 | 27 |
| " 8" | "216.0" | "7.0" | "xxxxxxxxxx" | "QFiGRwNERAcxCCQcgwXZmVgADLfneqPGPoyoCTrMKOajUhKRce" | "0.0" | "8.0" | "rvCgRW7Qcvcc9vTcXdxjHaiDc9I=" | "oracletoaerospike2" | 2587973 | 27 |
| " 3" | "504.0" | "2.0" | "xxxxxxxxxx" | "jrIWMuAWViCOdbspYtDDZrsqaBlItIXvUKQujEYOPRzmGoxGrp" | "0.0" | "3.0" | "k/FnJZNfA3IfjRhqrWs0zt78rVc=" | "oracletoaerospike2" | 2587973 | 27 |
| " 9" | "549.0" | "8.0" | "xxxxxxxxxx" | "nodLTROuwmdLhpalFVIprLxIHDrRgqHbTTbahCskowCuzpMoqq" | "0.0" | "9.0" | "SmryZ8Ciaqqzo8ixPckB1d2aZ8o=" | "oracletoaerospike2" | 2587973 | 27 |
+--------------+------------+-----------+--------------+------------------------------------------------------+-----------+--------+--------------------------------+----------------------+---------+-------+
10 rows in set (0.093 secs)
The bin “ID” is the primary key. But it is not shown as primary key
If I try to use spark to read the set, I get
val dfRead = sqlContext.read.
format("com.aerospike.spark.sql").
option("aerospike.batchMax", 10000).
load
dfRead.select("*").orderBy("ID").show(1,false)
+-----+-------------------------------------------------------------+---------+------------+-------+---+--------------------------------------------------+---------+----------+----------+----------+---------+
|__key|__digest |__expiry |__generation|__ttl |ID |RANDOM_STRING |CLUSTERED|SMALL_VC |PADDING |RANDOMISED|SCATTERED|
+-----+-------------------------------------------------------------+---------+------------+-------+---+--------------------------------------------------+---------+----------+----------+----------+---------+
|null |[98 53 82 BC CC 33 DE AA ED EE 4A 58 FF 6F AE EC F9 AE 8B 7E]|314398046|27 |2587494|1.0|rMLTDXxxqXOZnqYRJwInlGfGBTxNkAszBGEUGELqTSRnFjRGbi|0.0 | 1|xxxxxxxxxx|63.0 |0.0 |
+-----+-------------------------------------------------------------+---------+------------+-------+---+--------------------------------------------------+---------+----------+----------+----------+---------+
only showing top 1 row
So Spark brings all bins back but __key is null!
Obviously key is not stored through Python?
Thanks