Search code examples
pythonhadoopthriftimpala

Why "TypeError: 'module' object is not callable" occurs on calling impala.dbapi.connect()?


I am trying to connect to impala and I am following impyla guide. But I am getting this error as I execute connect(). The error is shown below:

In [27]: import impala.dbapi as connect

In [28]: conn = connect(host="some798.xyz.something", 
    ...:        port=22, 
    ...:        user="username", 
    ...:        password="password")
Traceback (most recent call last):

  File "<ipython-input-28-c9f42dc37774>", line 4, in <module>
    password="password")

TypeError: 'module' object is not callable

What is the possible reason that I am not being able to connect? I can connect to the server using the above mentioned parameters and can also access the database of my interest (using Putty shell). I have been searching allot but couldn't resolve it so far. Thanks allot for your time in advance and looking forward to your suggestions.

UPDATE:

The above error has been resolved after this below change:

from impala.dbapi import connect

But now I am facing another error after executing this line of code:

cursor = conn.cursor()

and the error is as below:

.
.
.

File "C:\Temp\Anaconda\lib\site-packages\thrift\transport\TSocket.py", line 105, in read
buff = self.handle.recv(sz)

MemoryError

Waiting for suggestions to resolve this issue. Thanks for your time :)


Solution

  • I think what you wanted to do is: from impala.dbapi import connect

    In your code you are using impala.dbapi (module) renamed as connect...