python-pinot-dbapi/pinot-dbapi

AttributeError: 'NoneType' object has no attribute '_username'

MinuraPunchihewa opened this issue · 1 comments

Hey guys,

First off, thank you very much for this amazing library. It's great to have a way to query Pinot using Python.

I have been having some trouble querying my database and I keep getting this error,

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [74], in <cell line: 1>()
----> 1 curs.execute('SELECT * FROM baseballStats')
      2 for row in curs:
      3     print(row)

File ~\Anaconda3\envs\pinotdb\lib\site-packages\pinotdb\db.py:56, in check_closed.<locals>.g(self, *args, **kwargs)
     54 if self.closed:
     55     raise exceptions.Error(f"{self.__class__.__name__} already closed")
---> 56 return f(self, *args, **kwargs)

File ~\Anaconda3\envs\pinotdb\lib\site-packages\pinotdb\db.py:448, in Cursor.execute(self, operation, parameters)
    441 @check_closed
    442 def execute(self, operation, parameters=None):
    443     query = self.finalize_query_payload(operation, parameters)
    445     r = self.session.post(
    446         self.url,
    447         json=query,
--> 448         auth=(self.auth._username, self.auth._password))
    449     return self.normalize_query_response(query, r)

AttributeError: 'NoneType' object has no attribute '_username'

Additionally, I also see this error in my terminal,
'_xsrf' argument missing from POST

What exactly is the issue here?

This is simply what my code looks like,

from pinotdb import connect

conn = connect(host='localhost', port=8099, path='/query/sql', scheme='http')
curs = conn.cursor()

curs.execute('SELECT * FROM baseballStats')
for row in curs:
    print(row)

Note: I've tried a few other ports as well, including 9000.

I've followed the quick start instructions on the Pinot documentation and run the following commands to get my server running,

docker pull apachepinot/pinot:latest

docker run -p 9000:9000 pinot:latest QuickStart -type batch

I can access the server through the web UI just fine.

Do I need to provide a username and password? If so, what is the default username and password that I should include here?

By the way I am using Python version Python 3.10.4 and pinotdb 0.4.1.

Closing this as it was solved by this,
apache/pinot#9185