Skip to content

Instantly share code, notes, and snippets.

@robert-zaremba
Last active January 2, 2016 14:09
Show Gist options
  • Save robert-zaremba/8315182 to your computer and use it in GitHub Desktop.
Save robert-zaremba/8315182 to your computer and use it in GitHub Desktop.
A code which shows 2 different evaluation of RethinkDB ReQL filter which is suppose to return two same data, but it doesn't.
import calendar
from datetime import datetime as dt
import rethinkdb as r
r.connect( "localhost", 28015).repl()
table = r.db('test').table('test')
print table.delete().run()
docs = [{'t': i} for i in range(20)]
print table.insert(docs).run()
start, end = 10, 12
print table.filter(
lambda row: row['t'] >= start & row['t'] < end
).count().run() # 12
print table.filter(
r.row['t'].ge(start) & r.row['t'].lt(end)
).count().run() # 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment