3

I am trying to insert a record in aerospike as following :

insert into NameSpace.SetName(PK,id,value,formId) values("1","23","hello","");

And I am getting following error:

Unsupported command format with token -  '""' 
Make sure string values are enclosed in quotes.
Type " aql --help " from console or simply "help" from within the aql- 
prompt. 

Any help is appreciated.

Awadesh
  • 3,530
  • 2
  • 20
  • 32

1 Answers1

3

Seems to work for me:

$ aql
Seed:         127.0.0.1
User:         None
Aerospike Query Client
Version 3.15.3.14
C Client Version 4.3.12
Copyright 2012-2017 Aerospike. All rights reserved.
aql> insert into test.stackoverflow (PK,id,value,formId) values("1","23","hello","");
OK, 1 record affected.

aql> select * from test.stackoverflow where PK="1"
+------+---------+--------+
| id   | value   | formId |
+------+---------+--------+
| "23" | "hello" | ""     |
+------+---------+--------+
1 row in set (0.011 secs)

OK

The server version is

$ asd --version
Aerospike Community Edition build 4.3.0.2

Alternatively, use one of the language clients. You shouldn't be trying to build an application over AQL, it's just a tool for admin (with light-weight data browsing).

Install

$ sudo yum install python-devel
$ sudo yum install openssl-devel
$ pip install aerospike
$ python

Run

>>> import aerospike
>>> config = {'hosts': [('127.0.0.1', 3000)]}
>>> client = aerospike.client(config).connect()
>>> key = ('test', 'stackoverflow', '1')
>>> client.put(key, {'id': '23', 'value': 'hello', 'formId': ''})
0L
>>> import pprint
>>> pprint.pprint(client.get(key))
(('test',
  'stackoverflow',
  None,
  bytearray(b'CHu\xf09%a\xf0\x8d\x86\x14\x0f\xea\x93\xeb\xf6\x7f\x16\x87\xd0')),
 {'gen': 1, 'ttl': 431818},
 {'formId': '', 'id': '23', 'value': 'hello'})
Ronen Botzer
  • 6,951
  • 22
  • 41
  • Currently I am using 3.14 version and its in production we can't update as of now , Any work around ?? – Awadesh Sep 19 '18 at 10:37
  • 1
    Why do it though? You can always add the formID bin to the record when you have real data to put in. – pgupta Sep 19 '18 at 15:33
  • (1) You can install the [tools package](https://www.aerospike.com/download/tools/latest) on another machine (not a cluster node) and talk to the cluster with it. (2) A work around would be to use the [Python](https://www.aerospike.com/apidocs/python/) command line, or script it in any language. AQL is just a tool built on top of the C client. The same functionality exists in the [clients](https://www.aerospike.com/download/client/) for Java, C#, Python, Go, Node.js, ... – Ronen Botzer Sep 19 '18 at 20:37