Python driver for RethinkDB
Questions tagged [rethinkdb-python]
140 questions
2
votes
2 answers
RethinkDB insert and conflict resolution function syntax
I'm trying to learn how to use the lambda function to resolve conflicts when inserting into a table with rethinkdb and python, like the last example on this page. I would like to compare a timestamp field between the old_doc and new_doc and keep the…

chacalle
- 33
- 5
2
votes
2 answers
Limit and rank a group count in RethinkDB
My documents contain 7 fields, one of them is "city", values are different cities. When I do
r.db('base').table('table').group('city').count().run()
RethinkDB groups the number of documents by cities. The output is a list of 277 cities each one…

crocefisso
- 793
- 2
- 14
- 29
2
votes
1 answer
Specifying data type while importing from CSV into RethinkDB
I am using 'rethinkdb import' to import a CSV file where one of the fields is a valid JSON object. However, it seems like RethinkDB is encoding this field as a string since I am unable to use nested filters to query the data set.
How do I specify…

Alienfluid
- 326
- 1
- 3
- 11
2
votes
2 answers
Rethinkdb Scalability
How scalable is rethinkdb? Can it be used for TB's of data?
I have around 400 GB's of data, which are bound to increase by 10-25 GB's per week. Any suggestions, would be of great help.

hellodk
- 316
- 4
- 11
2
votes
1 answer
RethinkDB insert data with relationship
I have a table A and a table B.
Table B has a relationship with A with the key a_id.
I already created the document in a in table A.
I'm wondering how to insert data in a single query using a doc in table B with foreign key…

Alexis Benoist
- 2,400
- 2
- 17
- 23
2
votes
2 answers
Multiple filter using lambda in python on rethinkdb?
I am trying to filter the array object inside a table. Here is a case where I have filtered and it works perfectly.
tags = ["school", "hollywood"]
tagsLambda = lambda post: (post["tags"].contains(tags[0])) | (post["tags"].contains(tags[1]))
d =…

iraycd
- 892
- 1
- 8
- 23
2
votes
1 answer
RethinkDB: multiple comparisons filtering
By the docs, it seems that in order to filter all users that are 30 years old OR 40 years old, I can do this (with python):
r.table("users").filter((r.row["age"].eq(30)) | (r.row["age"].eq(40))).run(conn)
Say I have a list based on input / request:…

Kludge
- 2,653
- 4
- 20
- 42
2
votes
1 answer
RethinkDB: How to dynamically build merge queries?
I am building an API using Python Flask. I love the ease for coding merge queries on RethinkDB. Even better, I've noticed that it may be possible to write a thin layer to code dynamic merge queries in regards to user input.
Let's say we are building…

Dogukan Tufekci
- 2,978
- 3
- 17
- 21
2
votes
1 answer
RethinkDB: "TypeError: 'Var' object is not callable" when using lambda function in filter
In RethinkDB's data explorer, I'm running this query successfully using javascript:
r.db('my_db').table('my_table').filter(function(row){return row('some_key').match(".sometext.")})
But when I'm running it correspondingly in python like…

Kludge
- 2,653
- 4
- 20
- 42
2
votes
1 answer
How can I get rows between dates in rethinkdb?
Following the answer here, I'm getting the latest rows out of my table by indexing the 'date' field and querying like this:
table.orderBy({index: r.desc("date")})
How can I filter between dates if the 'date' values are implemented as strings (e.g…

Kludge
- 2,653
- 4
- 20
- 42
2
votes
3 answers
RethinkDB: Getting all documents that contain a string in any field
I want to perform a query that will return all the documents that contain a given string in ANY of their fields. For example, say I have a "users" table and I'm looking for all the documents that contain "john", the returned result can…

user3162581
- 21
- 2
2
votes
1 answer
How to get reponse of multiple queries in a single RethinkDB request?
I want to squash two requests:
a = r.table('A').run(conn)
b = r.table('B').run(conn)
in a single one. Something like:
out = some_reql({
'a': r.table('A'),
'b': r.table('B')
}).run(conn)
out['a']
out['b']

Robert Zaremba
- 8,081
- 7
- 47
- 78
1
vote
1 answer
JSON Parsing with python from Rethink database [Python]
Im trying to retrieve data from a database named RethinkDB, they output JSON when called with r.db("Databasename").table("tablename").insert([{ "id or primary key": line}]).run(), when doing so it outputs [{'id': 'ValueInRowOfid\n'}] and I want to…

Dec1lent
- 13
- 4
1
vote
1 answer
Rethinkdb: "Connection closed"
I'm using rethinkdb with flask (python 3) that is hosted locally on a Windows machine.
The problem is that connection is being closed very frequently.
The error looks like this:
rethinkdb.errors.ReqlDriverError: Connection is closed.
In python i…

Jakov Gl.
- 361
- 3
- 11
1
vote
1 answer
Python unicode escape for RethinkDB match (regex) query
I am trying to perform a rethinkdb match query with an escaped unicode user provided search param:
import re
from rethinkdb import RethinkDB
r = RethinkDB()
search_value = u"\u05e5" # provided by user via flask
search_value_escaped =…

Bogdan
- 105
- 8