I’m running Dremio community edition on docker , trying to connect using sample code snippet below but always got unauthenticated error
> <class 'pyarrow._flight.FlightUnauthenticatedError'> : Flight returned unauthenticated error, with message:
My code snippet
class BasicAuthClientAuthHandler(flight.ClientAuthHandler):
def init(self, username, password):
super().init()
self.username = username
self.password = password
def authenticate(self, outgoing, incoming):
logger.debug("Sending basic auth credentials")
outgoing.write(self.username.encode('utf-8'))
outgoing.write(self.password.encode('utf-8'))
#outgoing.close()
logger.debug("Waiting for auth response")
incoming.read() # blocks until server accepts or rejects
def get_token(self):
return b"" # Optional: implement if server returns a token
class DremioClient:
def init(self, host, port, username, password):
self.location = f"grpc+tcp://{host}:{port}"
logger.info(f"Connecting to Dremio at {self.location}")
self.client = flight.FlightClient(self.location)
self._auth(username, password)
def _auth(self, username, password):
logger.info(f"Authenticating as {username}")
auth_handler = BasicAuthClientAuthHandler(username, password)
self.client.authenticate(auth_handler)
logger.info("Authentication successful")
Any advise how to fix this code