0

Using cx_Oracle connector to read into pandas df works fine, for e.g:

import pandas as pd
import cx_Oracle

conn_str = u'username/password@host:port/service_name'
conn = cx_Oracle.connect(conn_str)
tablequery="select * from largetable where rownum <= 5000000"
pd_df = pd.read_sql(tablequery, conn)

However trying to read this table into a Dask dataframe ...

import dask.dataframe as dd

sqlalchemy_uri_orcl = "oracle:////username:password@host:port//service_name" 

uri from here with escape characters for Windows 10 and:

dask_df = dd.read_sql_table(table = tablequery, uri = sqlalchemy_uri_orcl, index = "IDX")

dd call from here, generates the following errors:

Error message: DatabaseError: (cx_Oracle.DatabaseError) ORA-12545: Connect failed because target host or object does not exist

Without escaping the '/' in the uri, the error is slightly different:

NoSuchTableError:

Not sure exactly how to pass the cx_Oracle connector to the dask call, if required

Thanks

Community
  • 1
  • 1
shanlodh
  • 1,015
  • 2
  • 11
  • 30

1 Answers1

0

I'm not sure your URI looks right. In other answers they use the following, which I imagine works with Dask also:

host=hostname
port=port
sid='sid'
user='username'
password='password'
sid = cx_Oracle.makedsn(host, port, sid=sid)

uri = 'oracle://{user}:{password}@{sid}'.format(
    user=user,
    password=password,
    sid=sid
)

mdurant
  • 27,272
  • 5
  • 45
  • 74