0

I'm having a complication in consulting my database RethinkDB with python. When I query as below with get_all, I have the correct return from the database.

QUERY = r.db("REPO").table("TABLE").get_all('X', 'Y')\
    .pluck({'CURRENT': {'CONFIG': {'DATA': {CMD: True}}}}).run()

But I wanna do it more flexible, reading the list of items and run as variable in the Query, as below.

**LIST **= ['X','Y']
QUERY = r.db("REPO").table("TABLE").get_all(**LIST**)\
    .pluck({'CURRENT': {'CONFIG': {'DATA': {CMD: True}}}}).run()

Full code of connection and query in Python:

**LIST**= 'X', 'Y'
CMD = 'CELL'

r.connect('IP', 9000).repl()

QUERY = r.db("REPO").table("TABLE").get_all(**LIST**)\
    .pluck({'CURRENT': {'CONFIG': {'DATA': {CMD: True}}}}).run()

Data return from RethinkDB:

[{'CURRENT': {'CONFIG': {'DATA': {'CELL': {'ADDITIONALSPECTRUMEMISSION': '1'}}}}},
 {'CURRENT': {'CONFIG': {'DATA': {'CELL': {'ADDITIONALSPECTRUMEMISSION': '2'}}}}}]

I tried to create this variable as string, tuple and list. But had no return from the RethinkDB.

0 Answers0