Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-6415

Access to Phoenix from Python using SPNEGO

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 5.0.0
    • Fix Version/s: None
    • Component/s: queryserver
    • Labels:
      None

      Description

      When connecting from Python using SPNEGO as the authentication mechanism an exception occurs:

      import phoenixdb
      import phoenixdb.cursor
      database_url = 'http://myphoenixdbserver:8765/'
      conn = phoenixdb.connect(database_url, autocommit=True, authentication="SPNEGO")

      Causes the following exception:

      venv/lib/python3.6/site-packages/phoenixdb/avatica/client.py:121: RuntimeWarning: Unexpected end-group tag: Not all data was converted
      {{ if not err.ParseFromString(message.wrapped_message):}}
      Traceback (most recent call last):
      {{ File "<stdin>", line 1, in <module>}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/_init_.py", line 121, in connect}}
      {{ return Connection(client, **kwargs)}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/connection.py", line 53, in _init_}}
      {{ self.open()}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/connection.py", line 98, in open}}
      {{ self._client.open_connection(self._id, info=self._phoenix_props)}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/avatica/client.py", line 363, in open_connection}}
      {{ response_data = self._apply(request)}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/avatica/client.py", line 215, in _apply}}
      {{ parse_error_protobuf(response_body)}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/avatica/client.py", line 128, in parse_error_protobuf}}
      {{ raise_sql_error(err.error_code, err.sql_state, err.error_message)}}
      {{ File "venv/lib/python3.6/site-packages/phoenixdb/avatica/client.py", line 96, in raise_sql_error}}
      {{ raise errors.InternalError(message, code, sqlstate)}}
      phoenixdb.errors.InternalError: ('', 0, '', None)

      This exception is caused because phoenixdb is using Kerberos 5 instead of SPNEGO.

      To resolve this issue, we have prepared a patch following the idea described in the "Explicit Mechanism" section of requests-gssapi. The attached patch fixes phoenixdb so that SPNEGO can be used to authenticate.

      If you want, I can create a branch and pull request for this.

        Attachments

        1. phoenixdb.patch
          0.9 kB
          Carlos García Montoro

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              TrilceAC Carlos García Montoro
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: