cocoa-xu opened a new pull request, #1722:
URL: https://github.com/apache/arrow-adbc/pull/1722

   Hi this PR is a preliminary Go implementation for Google BigQuery as the 
preferred approach to PR https://github.com/apache/arrow-adbc/pull/1717. 
   
   Currently it supports query functionality as a proof of concept, users can
   
   - set most supported options for statements
   - send queries and read the result table in Arrow format
   
   It gives the same results as in #1717 using this driver in Elixir using 
[elixir-explorer/adbc](https://github.com/elixir-explorer/adbc).
   
   ```elixir
   Mix.install([{:adbc, "~> 0.3.2-dev", github: "elixir-explorer/adbc"}])
   
   defmodule BigqueryTest do
     def test do
       children = [
         {Adbc.Database,
          "adbc.bigquery.sql.project_id": "bigquery-poc-418913",
          driver: "libadbc_driver_bigquery.dylib",
          process_options: [name: MyApp.DB]},
         {Adbc.Connection, database: MyApp.DB, process_options: [name: 
MyApp.Conn]}
       ]
   
       Supervisor.start_link(children, strategy: :one_for_one)
   
       dbg(
         Adbc.Connection.query(MyApp.Conn, "SELECT * FROM 
google_trends.small_top_terms LIMIT 7", [],
           "adbc.bigquery.sql.query.write_disposition": "WRITE_TRUNCATE"
         )
       )
     end
   end
   
   BigqueryTest.test()
   ```
   
   ```
   [bigquery.exs:16: BigqueryTest.test/0]
   Adbc.Connection.query(MyApp.Conn, "SELECT * FROM 
google_trends.small_top_terms LIMIT 7", [],
     "adbc.bigquery.sql.query.write_disposition": "WRITE_TRUNCATE"
   ) #=> {:ok,
    %Adbc.Result{
      num_rows: nil,
      data: %{
        "dma_id" => [546, 546, 546, 546, 546, 546, 546],
        "dma_name" => ["Columbia SC", "Columbia SC", "Columbia SC", "Columbia 
SC",
         "Columbia SC", "Columbia SC", "Columbia SC"],
        "rank" => [15, 15, 15, 15, 15, 15, 15],
        "refresh_date" => [~D[2024-03-14], ~D[2024-03-14], ~D[2024-03-14],
         ~D[2024-03-14], ~D[2024-03-14], ~D[2024-03-14], ~D[2024-03-14]],
        "score" => [nil, nil, nil, nil, nil, nil, nil],
        "term" => ["Nex Benedict", "Nex Benedict", "Nex Benedict", "Nex 
Benedict",
         "Nex Benedict", "Nex Benedict", "Nex Benedict"],
        "week" => [~D[2020-12-13], ~D[2020-12-20], ~D[2021-02-21], 
~D[2021-02-28],
         ~D[2021-03-07], ~D[2021-03-14], ~D[2021-04-04]]
      }
    }}
   ```
   
   There're still a few thing to be done:
   
   - [ ] set credentials when initialising the database; currently Google Cloud 
SDK will automatically find and use credentials saved on local storage 
(generated by gcloud auth application-default login)
   - [ ] implement GetInfo, GetTableSchema and other functions for BigQuery's 
AdbcConnection and AdbcStatement
   - [ ] add tests for this driver


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to