Python driver for RethinkDB
Questions tagged [rethinkdb-python]
128 questions
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
- 557
- 1
- 5
- 20
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
- 266
- 3
- 9
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,349
- 2
- 14
- 21
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
- 814
- 1
- 8
- 22
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,305
- 4
- 18
- 35
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,378
- 3
- 14
- 20
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,305
- 4
- 18
- 35
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,305
- 4
- 18
- 35
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
- 6,780
- 6
- 40
- 71
1
vote
0 answers
Restore RethinkDB backup on MacOS Big Sur
My local Rethink database disappeared after upgrading to MacOS 11 (“Big Sur”). But that's alright, as I have a backup. But I can't, for the life of me, restore it.
rethinkdb restore [file] and rethinkdb import [file] didn't work, but after some…
Rasmus
- 326
- 2
- 6
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
- 95
- 8
1
vote
1 answer
Optimizing rethinkdb inner join query
For a given user I want to get all the runs that
satisfy some conditions
get only runs from projects that the user has access to
In Users table, every user has a list of project ids while in Runs table, every run has a project id. The following…
Sant
- 31
- 4
1
vote
1 answer
rethinkdb eqJoin on multiple fields
I want to run a query using join on two very large tables.
What is the equivalent rethinkdb syntax for this sql?
SELECT t1.uuid,t1.timestamp,t2.name
FROM t1
JOIN t2 ON t1.uuid=t2.uuid AND t1.timestamp=t2.timestamp
For the example reference, this is…
Zohar
- 11
- 1