How to get records without metadata?


#1

I am using python client and i need records without metadata please provide solution


#2

A record is the tuple (key, metadata, bins), just as the key is (namespace, set, pk). Why are you worried about getting back the metadata? You don’t have to use it.

(_, _, bins) = client.get(key)

The size of the metadata as it returns from the server node over the wire is very small compared to the data. On the client side those get turned into Python Dict data types. If you don’t need it, use the underscore variable.


#4

def print_result(record):

    print(record)

try:

query = client.query('test_test', 'demo')
query.select('email')
query.where(p.between('id', 1, 25))
query.foreach(print_result)

this is my sample code, i am getting metadata ,please provide solution.


#5

As described in the API, you’re getting back the record tuple which always (in any language client) consists of (key, metadata, bins). In Python, you can break up this tuple by multiple assignment, as I mentioned above in my example.

So, your print_result function simply needs to print the bins portion.

print(record[2])

Again, the server sends back this information beause this is what a record is. You’re talking about only wanting to use the bins portion. Fine, grab it and ignore the rest.


#6

thank you rbotzer it helps me alot