0

I have Apache Pinot running as a Docker container on my machine. Given below are the steps I followed to run the container,

docker pull apachepinot/pinot:latest

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

I am now trying to connect to it and run queries using the Python package pinotdb.

However, I keep running into this error,

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [31], in <cell line: 1>()
----> 1 curs.execute("""
      2     SELECT * 
      3     FROM baseballStats
      4     WHERE league IN (%(leagues)s)
      5     """, {"leagues": ["AA", "NL"]})
      6 for row in curs:
      7     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'

This is what my code looks like,

from pinotdb import connect

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

curs.execute("""
    SELECT * 
    FROM baseballStats
    WHERE league IN (%(leagues)s)
    """, {"leagues": ["AA", "NL"]})
for row in curs:
    print(row)

How can I resolve this?

Minura Punchihewa
  • 1,498
  • 1
  • 12
  • 35
  • Could you show the full error including the stack trace? Right now it's hard to tell where the error is coming from. – Bob th Jul 26 '22 at 19:03
  • Does this answer your question? [Why do I get AttributeError: 'NoneType' object has no attribute 'something'?](https://stackoverflow.com/questions/8949252/why-do-i-get-attributeerror-nonetype-object-has-no-attribute-something) – Ulrich Eckhardt Jul 26 '22 at 19:10
  • @Bobth I have updated my error message. – Minura Punchihewa Jul 26 '22 at 19:14
  • @UlrichEckhardt No, this does not really solve my issue. The error is thrown from within the `pinotdb` package and I am not sure what is causing it. – Minura Punchihewa Jul 26 '22 at 19:16

0 Answers0