exasol / pyexasol

Exasol Python driver with low overhead, fast HTTP transport and compression
MIT License
71 stars 39 forks source link

Pyexasol with SaaS Authentication error #86

Closed exa-eswar closed 2 years ago

exa-eswar commented 2 years ago

While trying to use the pyexasol with newly launched SaaS offering; I got the following error.

Installed latest pyexasol: Successfully installed pyexasol-0.24.0

Error after running above code: C = pyexasol.connect(dsn='SaaSURL.clusters.exasol.com:8563', user='myusername', password='mypwd', compression=True) df = C.export_to_pandas("SELECT * FROM EXA_ALL_USERS") print(df.head())

ExaAuthError: ( message => Connection exception - Authentication using OpenID Connect tokens is not supported (requires driver with version 7.1.0 or greater). dsn => SaaSURL.clusters.exasol.com:8563 user => myusername schema =>
session_id =>
code => 08004 )

Please comment if you require any additional details to reproduce the issue.

My system details: MacOS Monterey Intel i9, 8 core However, when I did the same thing with Notebook from Ec2 instance on Ubuntu 20.04, everything works fine. image

littleK0i commented 2 years ago

Could you try to enable debug=True connection option and attach logs?

Let's see the specific communication.

Thank you.

exa-eswar commented 2 years ago

2022-02-18 12:54:25.459 Connection attempt [3.65.41.37:8563] 2022-02-18 12:54:25.483 [WebSocket request #1] { "command": "login", "protocolVersion": 1 } 2022-02-18 12:54:25.492 [WebSocket response #1] { "status": "ok", "responseData": { "publicKeyPem": "-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAN6B9il3sEjDZMxHk3UcKW5f9VulTj2EwX4ghwsw2C1FTZKNOFYLB1or\nW3WWZsKIPokuh34I5GXEozEQhju6xcIKaGMr1tCRuvtnzy9olcSB6hjRY1Eng5xX\nEDN+TVu8UshVL70/ZkH9o5E7e0eFlnyubZNNdJ8vDUGIomBay+kJAgMBAAE=\n-----END RSA PUBLIC KEY-----\n", "publicKeyExponent": "010001", "publicKeyModulus": "DE81F62977B048C364CC4793751C296E5FF55BA54E3D84C17E20870B30D82D454D928D38560B075A2B5B759666C2883E892E877E08E465C4A33110863BBAC5C20A68632BD6D091BAFB67CF2F6895C481EA18D1635127839C5710337E4D5BBC52C8552FBD3F6641FDA3913B7B4785967CAE6D934D749F2F0D4188A2605ACBE909" } } 2022-02-18 12:54:25.493 [WebSocket request #2] { "username": "uid", "password": "somerandomstring", "driverName": "PyEXASOL 0.20.0", "clientName": "PyEXASOL", "clientVersion": "0.20.0", "clientOs": "macOS-10.16-x86_64-i386-64bit", "clientOsUsername": "eswar.nagireddy", "clientRuntime": "Python 3.9.7", "useCompression": true, "attributes": { "currentSchema": "", "autocommit": true, "queryTimeout": 0 } } 2022-02-18 12:54:28.254 [WebSocket response #2] { "status": "error", "exception": { "text": "Connection exception - Authentication using OpenID Connect tokens is not supported (requires driver with version 7.1.0 or greater).", "sqlCode": "08004" } }

ExaAuthError Traceback (most recent call last) /var/folders/78/1x3zcx5x05g8pz0j2gpj9s3r0000gq/T/ipykernel_32463/2391174904.py in ----> 1 C = pyexasol.connect(dsn='url.clusters.exasol.com:8563', user='uid', password='somerandomstring', compression=True,debug= True) 2 df = C.export_to_pandas("SELECT * FROM EXA_ALL_USERS") 3 print(df.head())

~/opt/anaconda3/lib/python3.9/site-packages/pyexasol/init.py in connect(**kwargs) 53 from .formatter import ExaFormatter 54 from .http_transport import ExaHTTPTransportWrapper ---> 55 from .local_config import ExaLocalConfig 56 from .logger import ExaLogger 57 from .mapper import ExaTimeDelta, exasol_mapper

~/opt/anaconda3/lib/python3.9/site-packages/pyexasol/connection.py in init(self, dsn, user, password, schema, autocommit, snapshot_transactions, connection_timeout, socket_timeout, query_timeout, compression, encryption, fetch_dict, fetch_mapper, fetch_size_bytes, lower_ident, quote_ident, json_lib, verbose_error, debug, debug_logdir, udf_output_bind_address, udf_output_connect_address, udf_output_dir, http_proxy, client_name, client_version, client_os_username, protocol_version, websocket_sslopt, access_token, refresh_token) 183 self._init_logger() 184 self._init_ws() --> 185 186 self._login() 187 self.get_attr()

~/opt/anaconda3/lib/python3.9/site-packages/pyexasol/connection.py in _login(self) 615 ret = self.req({ 616 'command': 'login', --> 617 'protocolVersion': self.options['protocol_version'], 618 }) 619

~/opt/anaconda3/lib/python3.9/site-packages/pyexasol/connection.py in req(self, req) 579 send_data = self.json_encode(req) 580 self.logger.debug_json('WebSocket abort request', req) --> 581 582 try: 583 self._ws_send(send_data)

ExaAuthError: ( message => Connection exception - Authentication using OpenID Connect tokens is not supported (requires driver with version 7.1.0 or greater). dsn => url.clusters.exasol.com:8563 user => uid schema =>
session_id =>
code => 08004 )

littleK0i commented 2 years ago

Ok, this is simple.

Your local pyexasol version on MacOS is older.

"driverName": "PyEXASOL 0.20.0",
"clientName": "PyEXASOL",
"clientVersion": "0.20.0",

Update to the latest version to be able to connect to SAAS.

exa-eswar commented 2 years ago

Thank you. This worked. "driverName": "PyEXASOL 0.24.0", "clientName": "PyEXASOL", "clientVersion": "0.24.0",

As a side note, I think there is exasol-sagemaker-extension dependancy. When I tried to !pip install exasol-sagemaker-extension, it installed pyexasol-0.20.0 automatically, which caused this error.

littleK0i commented 2 years ago

It needs to be updated in order to work with Exasol SAAS.

OpenID tokens and protocol version 3 are required for SAAS and were implemented in the most recent versions only.

I'll close the issue for now.