You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2023/06/12 12:52:39 UTC

[arrow-adbc] branch main updated: docs: add docs for Python Flight SQL Driver, add link to Go Snowflake driver (#724)

This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new 64779e98 docs: add docs for Python Flight SQL Driver, add link to Go Snowflake driver (#724)
64779e98 is described below

commit 64779e986cef5f4b3a3b47c3a4d0b119943d2539
Author: Diego Fernández Giraldo <ai...@gmail.com>
AuthorDate: Mon Jun 12 06:52:32 2023 -0600

    docs: add docs for Python Flight SQL Driver, add link to Go Snowflake driver (#724)
    
    Show a complete example, including DB connection options, for the Python
    block in the Flight SQL Driver. Fix the Python docstrings for using the
    custom header options.
---
 docs/source/driver/flight_sql.rst                     | 19 ++++++++++++++++---
 .../adbc_driver_flightsql/__init__.py                 |  4 ++--
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/docs/source/driver/flight_sql.rst b/docs/source/driver/flight_sql.rst
index 9ec20628..0e9f227d 100644
--- a/docs/source/driver/flight_sql.rst
+++ b/docs/source/driver/flight_sql.rst
@@ -97,9 +97,22 @@ the :cpp:class:`AdbcDatabase`.
 
       .. code-block:: python
 
-         import adbc_driver_flightsql.dbapi
-
-         with adbc_driver_flightsql.dbapi.connect("grpc://localhost:8080") as conn:
+         from adbc_driver_flightsql import DatabaseOptions
+         from adbc_driver_flightsql.dbapi import connect
+
+         headers = {"foo": "bar"}
+
+         with connect(
+             "grpc+tls://localhost:8080",
+             db_kwargs={
+                 DatabaseOptions.AUTHORIZATION_HEADER.value: "Bearer <token>",
+                 DatabaseOptions.TLS_SKIP_VERIFY.value: "true",
+                 **{
+                     f"{DatabaseOptions.RPC_CALL_HEADER_PREFIX.value}{k}": v
+                     for k, v in headers.items()
+                 },
+             }
+         ) as conn:
              pass
 
 Supported Features
diff --git a/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py b/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py
index 898d8e12..5fb69d77 100644
--- a/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py
+++ b/python/adbc_driver_flightsql/adbc_driver_flightsql/__init__.py
@@ -79,7 +79,7 @@ class ConnectionOptions(enum.Enum):
     #:
     #: This option should prefix the name of the header to add
     #: (i.e. it should be used like
-    #: ``f"{ConnectionOptions.RpcCallHeaderPrefix}.x-my-header"``).
+    #: ``f"{ConnectionOptions.RPC_CALL_HEADER_PREFIX}x-my-header"``).
     #:
     #: Overrides any headers set via the equivalent database option.
     RPC_CALL_HEADER_PREFIX = DatabaseOptions.RPC_CALL_HEADER_PREFIX.value
@@ -108,7 +108,7 @@ class StatementOptions(enum.Enum):
     #:
     #: This option should prefix the name of the header to add
     #: (i.e. it should be used like
-    #: ``f"{ConnectionOptions.RpcCallHeaderPrefix}.x-my-header"``).
+    #: ``f"{ConnectionOptions.RPC_CALL_HEADER_PREFIX}x-my-header"``).
     #:
     #: Overrides any headers set via the equivalent database or
     #: connection options.