AttributeError: module 'rethinkdb' has no attribute 'connect'

384 Views Asked by At

I am using the RethinkDB in my Jupyter Python Notebook. I have installed the RethinkDB server for my Windows setup. And server version is

C:\Users\rethinkdb-2.3.6>rethinkdb --version
rethinkdb 2.3.6-windows (MSC 190024215)

On the client side, I see the rethinkDB is : rethinkdb==2.4.2.post1. So when use my python code to connect to the DB which i have already started on my windows server, it gives the error as:

=>self.conn = r.connect('localhost', 28015)
AttributeError: module 'rethinkdb' has no attribute 'connect'

I have seen some earlier posts where there are comments that the way we connect to RethinkDB has changed from 2.4.X and I already tried the code options below but they did not help:

import rethinkdb as rdb
r = rdb.RethinkDB()
self.conn = r.connect('localhost', 28015)
1

There are 1 best solutions below

0
Dushan On

try this,

from rethinkdb import RethinkDB 
r = RethinkDB()

then try connecting it like this,

r.connect( "localhost", 28015).repl()