Posts

Showing posts with the label rethinkdb

How would I check if a filtered request returns an empty array?

Image
Clash Royale CLAN TAG #URR8PPP How would I check if a filtered request returns an empty array? I started Javascript around a year and a half ago but I started Python around a week ago so I'm still a beginner at this. So I'm trying to figure out if a user is already stored into the users table and if they aren't then it will add them to it and if they are then it skips. import rethinkdb as r r.db('bot').table('users').filter(r.row["id"] == "253544423110082589").run() this code should return <rethinkdb.net.DefaultCursor object at 0x03DAAE10> (done streaming): [ ] So how exactly would I check if its empty? I tried something like if not r.db('bot').table('users').filter(r.row["id"] == "253544423110082589").run(): # add user to table else: continue but it continues even when the user isn't in the table. So please tell me what I'm doing wrong and how I can actually get it to work ...