How to connect SciDB by python?


#1

dear all:
After I installed the Scidb-py,I run the following snippet.

import numpy as np
from scidbpy import connect
sdb = connect(‘http://localhost:1239’)
the port:1239 is one of my SciDB instance ports.

But I could not connect to SciDB , the error information look like this:

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python2.6/site-packages/scidbpy/interface.py”, line 1847, in connect
return SciDBShimInterface(url, user=username, password=password)
File “/usr/lib/python2.6/site-packages/scidbpy/interface.py”, line 1637, in init
.format(self.hostname, e))
ValueError: Could not connect to a SciDB instance at localhost:1239. (‘Connection aborted.’, error(104, ‘Connection reset by peer’))

So I do not know how to deal with it, any help would be much appreciated!!!


#2

Hi,

This error message might mean that shim is not configured properly – if you point your browser to localhost:1239 , do you get to a shim webpage? If not, then shim isn’t set up properly (or it’s not set up on port 1239). If you do, then there might be a subtler authentication / scidb-py issue to diagnose


#3

do you have resolved it ? I have the same time and I don’t know how to connect scidb to python,if u are sucessful,can u give me some idears ? thank u


#4

Hi,
I guess it was caused by your connect string. Maybe you could try this one: connect(‘http://localhost:8080’) . And ‘8080’ here is the port number used by the shim.


#5

Looks like the connection configuration is not working for me. I have a similar challenge. Can someone here who has overcome this error, kindly elaborate more. I have been stuck for long – and can not seem to get head around it.

Thanks
Gerald


#6

The SciDB-Py library has evolved significantly since the original post on this thread. Could you elaborate on how you are trying to connect and what error do you get?


#7

Hi @rares, kindly see the errors below when i import and connect to scidb via python

from scidbpy import connect
sdb = connect('http://localhost:8080')
-----------------------------------------------------------
**ERROR: 1**
    1 import numpy as np
      2 from scidbpy import connect
----> 3 sdb = connect('http://localhost:8080')

TypeError: connect() takes exactly 3 arguments (1 given)

**WHEN I IMPUT the 3 arg as in:**
------------------------------------------------------------------------------
sdb = connect('http://localhost:8080','root','paradigm4')
---> 1 db = connect('http://localhost:8080','scidb','paradigm')

/home/nathan/anaconda2/lib/python2.7/site-packages/scidbpy/interface.pyc in connect(url, username, password)
   1917         password = os.environ.get('SCIDB_PASSWORD', "paradigm4")
   1918 
-> 1919     result = SciDBShimInterface(url, username, password)
   1920 
   1921     return result

/home/nathan/anaconda2/lib/python2.7/site-packages/scidbpy/interface.pyc in __init__(self, hostname, user, password, pam, digest)
   1702         except Exception as e:
   1703             raise ValueError("Could not connect to a SciDB instance at {0}. {1}"
-> 1704                              .format(self.hostname, e))
   1705 
   1706         self._refresh_afl()

ValueError: Could not connect to a SciDB instance at http://localhost:8080. invalid literal for int() with base 10: '5g696j4tnaltoeryxx3ih7r9qcreca5x'

I HAVE ALL MY 4 INSTANCES RUNNING FROM MY SHIM INTERFACE. BUT NOW I WOULD LIKE TO CONNECT TO SCIDB USING JUPYTER NOTEBOOK. HAS ANYONE MANAGED  TO GO OVER THIS POINT. THANKS


#8

From the error log it looks like you’re using a SciDB-Py version that is more than one year old. The library has been rewritten from scratch since then. The older SciDB-Py version only supports SciDB versions up to 16.9.

If you use a newer SciDB version, like 18.1, you need to upgrade the SciDB-Py version to a 18.1.x version. Depending on how you installed the original SciDB-Py library something like pip install --upgrade scidb-py should get you the latest SciDB-Py verison. The Quick Start section in the SciDB-Py manual should help you get started.