Skip to main content
Version: devel

dlt.destinations.impl.snowflake.utils

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

View source on GitHub

Generates a Snowflake COPY command to load data from a file.

Arguments:

  • use_vectorized_scanner - Whether to use the vectorized scanner in COPY INTO
  • file_url - URL of the file to load
  • qualified_table_name - Fully qualified name of the target table
  • loader_file_format - Format of the source file (jsonl, parquet, csv)
  • is_case_sensitive - Whether column matching should be case-sensitive
  • stage_name - Optional name of a predefined Snowflake stage
  • stage_bucket_url - Optional URL of the bucket containing the file
  • local_stage_file_path - Path to use for local files
  • staging_credentials - Optional credentials for accessing cloud storage
  • csv_format - Optional configuration for CSV format

Returns:

A SQL string containing the COPY command

snowflake_session_token_available

def snowflake_session_token_available() -> bool

View source on GitHub

Whether Snowflake-provided OAuth token is available in environment.

Reference: https://docs.snowflake.com/en/developer-guide/snowpark-container-services/additional-considerations-services-jobs#connecting-with-a-snowflake-provided-oauth-token

read_snowflake_session_token

def read_snowflake_session_token() -> str

View source on GitHub

Read the session token supplied automatically by Snowflake. These tokens are short lived and should always be read right before creating any new connection.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.