c# - 如何使用c#在apache drill中显示来自sql server的数据

标签 c# .net apache-drill

大家好, 我想在我的 C# 编程中使用 Apache Drill。 我想使用 apache drill 在网页中显示来自 sql server 的数据。请帮助我。

最佳答案

与其直接使用 jdbc 驱动程序进行 apache 钻取,不如利用 REST API over http。您可以阅读更多信息 here .

事实上,我实际上已经使用 .NET 实现了此功能,在本例中是 F# 而不是 C#,但这无关紧要。

请看下面的示例代码片段:

#r "../packages/FSharp.Data/lib/net40/FSharp.Data.dll"

open FSharp.Data
open FSharp.Data.HttpRequestHeaders

let asyncExecute (queryString : string) =  

    printfn "Executing query string:\n%s..." queryString

    Http.AsyncRequestString(
        url = "http://10.xx.xx.xx:8047/query.json",
        httpMethod = "Post",
        headers = [ ContentType HttpContentTypes.Json ],
        body = TextRequest (sprintf """{"queryType":"SQL", "query": "%s"}""" (queryString.Replace("\r\n", "").Replace("\n", "").Replace("\r", "")))
    )

let sql =
    @"Select DateKey,
            `Date` 
         From dwTest.SalesDriversDatamart.dwh.DimDate 
         Where Cast(`Date` As Date) = Cast('1990-01-02' As Date)"    

let jsonResult = 
    asyncExecute sql
    |> Async.RunSynchronously

关于c# - 如何使用c#在apache drill中显示来自sql server的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35124638/

相关文章:

c# - ProcessStartInfo.Argument 如何考虑参数

c# - 有没有一种方法可以在 azure 函数启动后立即调用通过依赖项注入(inject)注入(inject)的类中的方法?

hadoop - 使用Drillbit.sh的Apache Drill启动NoSuchMethod异常(Jackson JsonFactory)

c# - Windows defrag 不是内部或外部命令,也不是可运行的程序或批处理文件

c# - 使用计时器显示文本 3 秒?

c# - 为什么你是 app.config?

c# - 如何消除接口(interface)之间的重复

hadoop - Apache 钻配置

sql - Drill SQL 中的 NumberFormatException 当它实际上是一个数字时转换为 BIGINT

c# - System.InvalidOperationException : Variable '' of type '' referenced from scope '' , 但未定义