Reputation: 11
The command "rdb.table('newnmeadata').orderBy('nos')" works fine in the RethinkDB data explorer. 'Nos' is the primary key. There are no problems with getting data (for a socket feed) using ".with_fields" but the RethinkDB serves the data in any old order. I have tried many many iterations of the below but am now stumped?
import rethinkdb as r
rdb = r.RethinkDB()
rdb.connect('localhost', 28015).repl()
while True:
cursor = rdb.table('newnmeadata').orderBy('nos').run()
for document in cursor:
msg = (str(document)[10:-13])
print(msg)
Produces the following error:
Python 3.8.1 (C:/Program Files (x86)/Python/python.exe) %Run datastream.py Traceback (most recent call last): File "C:\Program Files (x86)\Python\MyPy\datastream.py", line 7, in cursor = rdb.table('newnmeadata').orderBy('nos').run() AttributeError: 'Table' object has no attribute 'orderBy'
Upvotes: 0
Views: 304
Reputation: 11
Thanks order_by worked in python :) My Command:
QueryData = r.db('myDB').table('Posts').order_by(r.desc('Data_Time')).run()
works Well Thanks again :)
Upvotes: 1