dlt.destinations.impl.snowflake.utils
CONNECTION_FILE_PATH_PARAMS
Connection parameters that hold a file path
gen_copy_sql
def gen_copy_sql(
file_url: str,
qualified_table_name: str,
loader_file_format: TLoaderFileFormat,
is_case_sensitive: bool,
stage_name: Optional[str] = None,
stage_bucket_url: Optional[str] = None,
local_stage_file_path: Optional[str] = None,
staging_credentials: Optional[CredentialsConfiguration] = None,
csv_format: Optional[CsvFormatConfiguration] = None,
use_vectorized_scanner: Optional[bool] = False) -> str
Generates a Snowflake COPY command to load data from a file.
Arguments:
use_vectorized_scanner- Whether to use the vectorized scanner in COPY INTOfile_url- URL of the file to loadqualified_table_name- Fully qualified name of the target tableloader_file_format- Format of the source file (jsonl, parquet, csv)is_case_sensitive- Whether column matching should be case-sensitivestage_name- Optional name of a predefined Snowflake stagestage_bucket_url- Optional URL of the bucket containing the filelocal_stage_file_path- Path to use for local filesstaging_credentials- Optional credentials for accessing cloud storagecsv_format- Optional configuration for CSV format
Returns:
A SQL string containing the COPY command
snowflake_session_token_available
def snowflake_session_token_available() -> bool
Whether Snowflake-provided OAuth token is available in environment.
read_default_snowflake_connection_name
def read_default_snowflake_connection_name() -> str
Reads the default connection name of the connector from
SNOWFLAKE_DEFAULT_CONNECTION_NAME or config.toml, else returns default.
list_snowflake_connections
def list_snowflake_connections() -> List[str]
Names of the connections that the connector finds in connections.toml or config.toml.
get_snowflake_default_connection_name
def get_snowflake_default_connection_name() -> Optional[str]
Default connection name of the connector, None when no such connection is defined or the
connector is not installed.
get_snowflake_container_connection_name
def get_snowflake_container_connection_name() -> Optional[str]
Name of the connection that Snowpark Container Services mounts into a container
(sessionTokenConfig.mountConnectionConfig), None outside such a container.
read_snowflake_connection_params
def read_snowflake_connection_params(connection_name: str) -> Dict[str, Any]
Parameters of connection connection_name with ~ expanded in its file paths.
get_snowflake_connection_file_paths
def get_snowflake_connection_file_paths(
connection_name: str) -> Dict[str, str]
Returns the file paths of connection connection_name with ~ expanded.
The connector does not expand ~, so dlt passes these paths to connect together with the
connection name.
read_snowflake_session_token
def read_snowflake_session_token() -> str
Read the session token supplied automatically by Snowflake. These tokens are short lived and should always be read right before creating any new connection.