ianmcook commented on code in PR #3876:
URL: https://github.com/apache/arrow-adbc/pull/3876#discussion_r2684553629


##########
docs/source/format/connection_profiles.rst:
##########
@@ -0,0 +1,568 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+..
+..   http://www.apache.org/licenses/LICENSE-2.0
+..
+.. Unless required by applicable law or agreed to in writing,
+.. software distributed under the License is distributed on an
+.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+.. KIND, either express or implied.  See the License for the
+.. specific language governing permissions and limitations
+.. under the License.
+
+==================================
+Driver Manager Connection Profiles
+==================================
+
+Overview
+========
+
+Similar to ODBC's ``odbc.ini``, the ADBC driver manager supports **connection 
profiles**
+that specify a driver and connection options in a reusable configuration. This 
allows users to:
+
+- Define connection information in files or environment variables
+- Share connection configurations across applications
+- Distribute standardized connection settings
+- Avoid hardcoding driver names and credentials in application code
+
+Profiles are loaded during ``AdbcDatabaseInit()`` before initializing the 
driver. Options
+from the profile are applied automatically but do not override options already 
set via ``AdbcDatabaseSetOption()``.
+
+Quick Start
+===========
+
+Using a Profile via URI
+-----------------------
+
+The simplest way to use a profile is through a URI:
+
+.. code-block:: c
+
+   AdbcDatabase database;
+   AdbcDatabaseNew(&database, &error);
+   AdbcDatabaseSetOption(&database, "uri", "profile://my_snowflake_prod", 
&error);
+   AdbcDatabaseInit(&database, &error);
+
+Using a Profile via Option
+---------------------------
+
+Alternatively, specify the profile name directly:
+
+.. code-block:: c
+
+   AdbcDatabase database;
+   AdbcDatabaseNew(&database, &error);
+   AdbcDatabaseSetOption(&database, "profile", "my_snowflake_prod", &error);
+   AdbcDatabaseInit(&database, &error);
+
+Profile File Format
+===================
+
+Filesystem-based profiles use TOML format with the following structure:
+
+.. code-block:: toml
+
+   version = 1
+   driver = "snowflake"
+
+   [options]
+   # String options
+   adbc.snowflake.sql.account = "mycompany"
+   adbc.snowflake.sql.warehouse = "COMPUTE_WH"
+   adbc.snowflake.sql.database = "PRODUCTION"
+   adbc.snowflake.sql.schema = "PUBLIC"
+
+   # Integer options
+   adbc.snowflake.sql.client_session_keep_alive_heartbeat_frequency = 3600
+
+   # Double options
+   adbc.snowflake.sql.client_timeout = 30.5
+
+   # Boolean options (converted to "true" or "false" strings)
+   adbc.snowflake.sql.client_session_keep_alive = true
+
+version
+-------
+
+- **Required**: Yes
+- **Type**: Integer
+- **Supported values**: ``1``
+
+The ``version`` field specifies the profile format version. Currently, only 
version 1 is supported.
+This will enable future changes while maintaining backward compatibility.
+
+driver
+------
+
+- **Required**: No
+- **Type**: String
+
+The ``driver`` field specifies which ADBC driver to load. This can be:
+
+- A driver name (e.g., ``"snowflake"``)
+- A path to a shared library (e.g., 
``"/usr/local/lib/libadbc_driver_snowflake.so"``)
+- A path to a driver manifest (e.g., ``"/etc/adbc/drivers/snowflake.toml"``)
+
+If omitted, the driver must be specified through other means (e.g., the 
``driver`` option or ``uri`` parameter).
+The driver will be loaded identically to if it was specified via 
``AdbcDatabaseSetOption("driver", "<driver>")``.
+For more detils, see :doc:`driver_manifests`.
+
+Options Section
+---------------
+
+The ``[options]`` section contains driver-specific configuration options. 
Options can be of the following types:
+
+**String values**
+   Applied using ``AdbcDatabaseSetOption()``
+
+   .. code-block:: toml
+
+      adbc.snowflake.sql.account = "mycompany"
+      adbc.snowflake.sql.warehouse = "COMPUTE_WH"
+
+**Integer values**
+   Applied using ``AdbcDatabaseSetOptionInt()``
+
+   .. code-block:: toml
+
+      adbc.snowflake.sql.client_session_keep_alive_heartbeat_frequency = 3600
+
+**Double values**
+   Applied using ``AdbcDatabaseSetOptionDouble()``
+
+   .. code-block:: toml
+
+      adbc.snowflake.sql.client_timeout = 30.5
+
+**Boolean values**
+   Converted to strings ``"true"`` or ``"false"`` and applied using 
``AdbcDatabaseSetOption()``
+
+   .. code-block:: toml
+
+      adbc.snowflake.sql.client_session_keep_alive = true
+
+Environment Variable Substitution
+----------------------------------
+
+Profile values can reference environment variables using the ``env_var()`` 
syntax:
+
+.. code-block:: toml
+
+   version = 1
+   driver = "adbc_driver_snowflake"
+
+   [options]
+   adbc.snowflake.sql.account = "env_var(SNOWFLAKE_ACCOUNT)"

Review Comment:
   Should we consider using `${}` instead of `env_var()`?
   
   That is more concise and makes escaping literals easier (e.g. with `\$` or 
`$$`).



-- 
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