【问题标题】:Apache Arrow flight SQL from C# client来自 C# 客户端的 Apache Arrow 飞行 SQL
【发布时间】:2023-02-17 08:01:41
【问题描述】:

我正在尝试开发一个 c# 客户端代码来使用基本身份验证使用 Apache Arrow Flight 查询数据,但到目前为止还没有成功。

如果有人可以分享工作样本,我将不胜感激。

谢谢 马诺乔治

【问题讨论】:

    标签: pyarrow apache-arrow dremio


    【解决方案1】:

    这里有示例代码:

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

    但是,要让它在 Dremio 中运行,您需要添加身份验证。以下是如何在本地主机测试环境中使用“HTTP”(而非 https)进行基本身份验证的示例。航班侦听端口 32010。我在示例中硬编码了用户名“mydremiouser”和密码“mydremiopassword”。

    // ...
                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);
    // ...
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多