Title: Authentication Helpers for 'Snowflake'
Version: 0.1.2
Description: Authentication helpers for 'Snowflake'. It provides compatibility with authentication approaches supported by the 'Snowflake Connector for Python' https://pypi.org/project/snowflake-connector-python and the 'Snowflake CLI' https://pypi.org/project/snowflake-cli.
License: MIT + file LICENSE
Encoding: UTF-8
Imports: cli, curl, jsonlite, RcppTOML, rlang
Suggests: jose, openssl, testthat (≥ 3.0.0), withr
RoxygenNote: 7.3.2
Config/testthat/edition: 3
URL: https://posit-dev.github.io/snowflakeauth/, https://github.com/posit-dev/snowflakeauth
BugReports: https://github.com/posit-dev/snowflakeauth/issues
NeedsCompilation: no
Packaged: 2025-06-18 13:05:51 UTC; edavidaja
Author: Aaron Jacobs [aut], E. David Aja [aut, cre], Posit Software, PBC [cph, fnd]
Maintainer: E. David Aja <david@posit.co>
Repository: CRAN
Date/Publication: 2025-06-19 15:20:02 UTC

snowflakeauth: Authentication Helpers for 'Snowflake'

Description

Authentication helpers for 'Snowflake'. It provides compatibility with authentication approaches supported by the 'Snowflake Connector for Python' https://pypi.org/project/snowflake-connector-python and the 'Snowflake CLI' https://pypi.org/project/snowflake-cli.

Author(s)

Maintainer: E. David Aja david@posit.co

Authors:

Other contributors:

See Also

Useful links:


Reports whether a default connection is available

Description

Reports whether a default connection is available

Usage

has_a_default_connection(...)

Arguments

...

arguments passed to snowflake_connection()

Value

Logical value indicating whether a default connection is available.

Examples

has_a_default_connection()

Snowflake connection parameter configuration

Description

Reads Snowflake connection parameters from the connections.toml and config.toml files used by the Snowflake Connector for Python and the Snowflake CLI, or specifies them for a connection manually.

Usage

snowflake_connection(name = NULL, ..., .config_dir = NULL)

Arguments

name

A named connection. Defaults to ⁠$SNOWFLAKE_DEFAULT_CONNECTION_NAME⁠ if set, the default_connection_name from the config.toml file (if present), and finally the ⁠[default]⁠ section of the connections.toml file, if any. See Snowflake's documentation for details.

...

Additional connection parameters. See Common parameters.

.config_dir

The directory to search for a connections.toml and config.toml file. Defaults to ⁠$SNOWFLAKE_HOME⁠ or ⁠~/.snowflake⁠ if that directory exists, otherwise it falls back to a platform-specific default. See Snowflake's documentation for details.

Value

An object of class "snowflake_connection".

Common parameters

The following is a list of common connection parameters. A more complete list can be found in the documentation for the Snowflake Connector for Python:

Examples


# Read the default connection parameters from an existing
# connections.toml file:
conn <- snowflake_connection()

# Read a named connection from an existing connections.toml file:
conn <- snowflake_connection(name = "default")

# Override specific parameters for a connection:
conn <- snowflake_connection(
  schema = "myschema",
  warehouse = "mywarehouse"
)

# Pass connection parameters manually, which is useful if there is no
# connections.toml file. For example, to use key-pair authentication:
conn <- snowflake_connection(
  account = "myaccount",
  user = "me",
  private_key = "rsa_key.p8"
)

Get credentials for a Snowflake connection

Description

Get credentials for a Snowflake connection

Usage

snowflake_credentials(params, role = NULL, spcs_endpoint = NULL, ...)

Arguments

params

a list of connection parameters from 'snowflake_connection()

role

a snowflake entity

spcs_endpoint

a Snowpark Container Services ingress URL, formatted (*-accountname.snowflakecomputing.app)

...

Additional Snowflake connection parameters

Value

A list of HTTP headers.

Examples


# Obtain authentication headers for accessing Snowflake APIs
snowflake_credentials(
 snowflake_connection()
)


# If the application is in Snowpark Container Services,
# a different collection of headers are returned:
snowflake_credentials(
 snowflake_connection(),
 spcs_endpoint = "https://example-accountname.snowflakecomputing.app"
)