0

I am trying to develop a c# client code to query data using Apache Arrow Flight using basic auth, but not successful so far.

I would appreciate if anyone can share a working sample.

Thanks Manoj George

MKG
  • 23
  • 5

1 Answers1

0

There is example code here:

https://github.com/apache/arrow/blob/master/csharp/examples/FlightClientExample/Program.cs

But, to get this to work in Dremio you will need to add authentication. The following is an example of how to use Basic authentication with "HTTP" (not https) on a localhost testing environment. Flight listens on port 32010. I have username of 'mydremiouser' and password of 'mydremiopassword' hardcoded in the example.

// ...
            string host = args.Length > 0 ? args[0] : "localhost";
            string port = args.Length > 1 ? args[1] : "32010";
            string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes("mydremiouser" + ":" + "mydremiopassword"));
            
            var httpClient = new HttpClient();
            httpClient.DefaultRequestHeaders.Add("Authorization", "Basic " + encoded);

            var address = $"http://{host}:{port}";
            var channel = GrpcChannel.ForAddress(address, new GrpcChannelOptions
            {
                HttpClient = httpClient
            });

            FlightClient client = new FlightClient(channel);
// ...

Getit
  • 1
  • 2