Rethinkdb Query Not Working

91 views Asked by At

I'm doing the following query on Rethinkdb:

r.table('skydata').filter(r.row("DeviceID").eq("JBAnFrdlbkcO").and(r.row("TS").ge(0)).and(r.row("TS").le(143556949)) ).orderBy("TS")

It worked perfect when run directly on Data Explorer on their website and returned me results. When I make the same query in my Python program, however, I got nothing. The query I wrote is:

records = rdb.table('skydata').filter( (rdb.row['DeviceID'] == 'JBAnFrdlbkcO') & (rdb.row['TS'] >= '0') & (rdb.row['TS'] <= '143556949') ).order_by('TS').run(conn)

Here records returned is empty. I think these two are equivalent. I also tried to send JS commands to the server directly:

records = rdb.js("r.table('skydata').filter(r.row('DeviceID').eq(%s).and(r.row('TS').ge(%s)).and(r.row('TS').le(%s)) ).orderBy('TS')" % (deviceid, time_start, time_end) ).run(conn)

But it says: r is not defined I really have no idea why it is like this. I would really appreciate it if someone could help. Thanks.

1

There are 1 answers

0
J Freebird On BEST ANSWER

So as mentioned in the discussions, the numbers in the query should not be quoted, unless they are strings. Unquote the numbers should make it work.