dlt.common.data_writers.escape
escape_snowflake_literal
def escape_snowflake_literal(v: Any) -> Any
Escape string literals for Snowflake.
Snowflake treats backslash as an escape character inside single-quoted literals, so both backslash and single quote are escaped (a lone backslash before a doubled quote would otherwise consume it and break out of the string).
escape_ansi_literal
def escape_ansi_literal(v: Any,
datetime_literal: Optional[Callable[..., str]] = None,
precision: int = 6,
no_tz: bool = False) -> Any
Escapes v as a standard SQL literal. A datetime renders with datetime_literal, by
default format_datetime_literal, at precision and naive in the context timezone with
no_tz, like the values stored without timezone support.
format_datetime_value
def format_datetime_value(v: datetime,
precision: int = 6,
no_tz: bool = False) -> str
ISO datetime string at given precision, optionally naive.
format_datetime_literal
def format_datetime_literal(v: datetime,
precision: int = 6,
no_tz: bool = False) -> str
Quoted SQL datetime literal.
format_bigquery_datetime_literal
def format_bigquery_datetime_literal(v: datetime,
precision: int = 6,
no_tz: bool = False) -> str
Returns BigQuery-adjusted datetime literal by prefixing required TIMESTAMP indicator.
Also works for Presto-based engines.
format_clickhouse_datetime_literal
def format_clickhouse_datetime_literal(v: datetime,
precision: int = 6,
no_tz: bool = False) -> str
Returns a toDateTime64 call: an aware value in UTC, a naive value as written, read in the
session timezone.