rethinkdb

How to retrieve data from RethinkDB via Django view?

余生长醉 提交于 2020-01-17 05:37:48
问题 Am trying to view data from RethinkDB in Django via custom middleware. Below is the middleware code am using to connect to RethinkDB @singleton class rDBMiddleware(object): connection = None def __init__(self): if self.connection == None: self.connection = r.connect(host=' 192.x.x.x ', port=28015, db=' re_test ').repl() views.py - from app.utils import rwrapper from app.utils import fields class MyTable(rwrapper): _db_table = 'test_table' name = fields.CharField(max_length=60) skill = fields

How to retrieve data from RethinkDB via Django view?

↘锁芯ラ 提交于 2020-01-17 05:37:07
问题 Am trying to view data from RethinkDB in Django via custom middleware. Below is the middleware code am using to connect to RethinkDB @singleton class rDBMiddleware(object): connection = None def __init__(self): if self.connection == None: self.connection = r.connect(host=' 192.x.x.x ', port=28015, db=' re_test ').repl() views.py - from app.utils import rwrapper from app.utils import fields class MyTable(rwrapper): _db_table = 'test_table' name = fields.CharField(max_length=60) skill = fields

How do I intersect multiple secondary index queries

↘锁芯ラ 提交于 2020-01-16 00:48:10
问题 If I have a table with multiple secondary indexes, how do I generate an intersection? For example, if I have a users table with secondary indexes on "firstName" and "lastName", and want all users named 'Bob Smith': r.table('users').getAll('Bob', {index: 'firstName'}).XXXX('Smith', {index: 'lastName'}) I can use a filter, but my understanding is that would be slower: r.table('users').getAll('Bob', {index: 'firstName'}).filter({'lastName': 'Smith'}) Alternatively, can I do intersections with a

Rethinkdb and python driver-unable to connect

荒凉一梦 提交于 2020-01-14 03:06:13
问题 Im having a problem with connecting to my RethinkDB local host using my python driver. The directory structure is: home/rethinkdb/drivers/python. When Im inside this python directory I start the python shell. I type import rethinkdb as r r.connect('localhost', 28015).repl() I get the error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "rethinkdb/net.py", line 366, in connect return Connection(host, port, db, auth_key, timeout) File "rethinkdb/net.py", line 136,

RethinkDB multiple queries in a single request

笑着哭i 提交于 2020-01-13 08:45:10
问题 I'm trying to execute several RQL commands in a single request to server, without much success I may add. I have tried r.union , but it only works with sequences. What I really want: [r.db(..).table(..).get(id1).delete(), r.db(..).table(..).get(id2).delete(), r.db(..).table(..).insert(...)].run_all_at_once Is there any way to do this? Thanks! 回答1: You can do r.expr( [r.db(...).table(...).get(id1).delete(), r.db(...).table(...).get(id1).delete(), r.db(...).table(...).insert(...) ] ).run(conn)

Rethinkdb audit trail with field timestamp and status when update/insert

感情迁移 提交于 2020-01-07 02:39:37
问题 I am trying to create a Rethinkdb database with an audit trail in node.js. My table contains the following fields: Order-ID Quantity Price Status Timestamp I have a file which I upload the following data as an example: Order-ID......Quantity.....Price 1....................'1000'..........100 2....................'500'............100 3....................'1575'..........100 When I upload in an empty table all these rows will be inserted along with the time&date and the status set to 'active'.

Docker私有云管理平台————Docker Shipyard

▼魔方 西西 提交于 2019-12-28 01:18:07
一、shipyard中文版安装(CentOS) 注:本文安装操作均在root用户下,安装前需先安装Docker ( 传送门 ) 下载所需docker镜像 docker pull rethinkdb docker pull microbox/etcd docker pull shipyard/docker-proxy docker pull swarm docker pull dockerclub/shipyard 下载官方脚本 wget https://shipyard-project.com/deploy 若下载失败请使用 wget https://raw.githubusercontent.com/shipyard/shipyard-project.com/master/site/themes/shipyard/static/deploy 或者直接创建文件,将内容复制进去 mkdir -p /usr/local/docker vi /usr/local/docker/deploy 完整脚本 #!/bin/bash if [ "$1" != "" ] && [ "$1" = "-h" ]; then echo "Shipyard Deploy uses the following environment variables:" echo " ACTION: this is the

Docker集中化web界面管理平台-Shipyard部署记录

旧街凉风 提交于 2019-12-28 01:10:57
Docker图形页面管理工具基本常用的有三种: DOCKER UI,Shipyard,Portainer 。对比后发现, Shipyard最强大,其次是Portainer,最后是Docker ui 。之前介绍了 DOcker的web管理工具DockerUI ,下面介绍下Docker的另一个web界面管理工具Shipyard的使用。Shipyard(github)是建立在docker集群管理工具Citadel之上的可以管理容器、主机等资源的web图形化工具,包括core和extension两个版本,core即shipyard主要是把多个 Docker host上的 containers 统一管理(支持跨越多个host),extension即shipyard-extensions添加了应用路由和负载均衡、集中化日志、部署等;Shipyard是在Docker Swarm实现对容器、镜像、docker集群、仓库、节点进行管理的web系统。 DockerUI功能: 通过Web浏览器的命令行来管理的任务。 DockerUI的优点 1)可以对运行着的容器进行批量操作 2)在容器网络中-会显示容器与容器间的网络关系 3)在Volumes中显示了所有挂载目录 DockerUI一个致命的缺点:不支持多主机.试想一下,如果有N台docker主机时-我就需要一台台的用dockerui进行管理

How to apply Greater than equal in python lambda expression in Rethinkdb

…衆ロ難τιáo~ 提交于 2019-12-25 16:54:01
问题 I have below json record in RethinkDB table. [{ "pid": 12, "sk": [ { "sid": 30, "et": 3 }, { "sid": 22, "et": 10 }, { "sid": 30, "et": 8 } ], "wc": [ { "wid": 7, "et": 8 }, { "wid": 3, "et": 6 }, { "wid": 9, "et": 7 } ] }] Like this one, I have millions of rows in the table. What am trying to achieve is to filter this json based on input sets of {sid,et} Am using below code in python (skObj is the input) :: skObj=[{'sid': 1, 'et': 9},{'sid': 27, 'et': 6}] cursor2=r.table('cube7').filter

How do I get the rank / row number for a row?

喜欢而已 提交于 2019-12-24 15:01:14
问题 Is there a way to get the row numbers (rank) for a filtered set and append the row number to the result? An example scenario would be that I have a table with records like: [ { points: 123, name: 'Glenn' }, { points: 948, name: 'Bob' }, { points: 22, name: 'Sarah' } ] In the above table there are hundreds of thousands of rows, and I want to be able to rank all records based on a condition like points descending and then return a subset of the rows (using a filter) with their rank value