dlt.destinations.utils
get_resource_for_adapter
def get_resource_for_adapter(data: Any) -> DltResource
Helper function for adapters. Wraps data in a DltResource if it's not a DltResource already.
Alternatively if data is a DltSource, throws an error if there are multiple resource in the source
or returns the single resource if available.
info_schema_null_to_bool
def info_schema_null_to_bool(v: str) -> bool
Converts INFORMATION SCHEMA truth values to Python bool
parse_db_data_type_str_with_precision
def parse_db_data_type_str_with_precision(
db_type: str) -> Tuple[str, Optional[int], Optional[int]]
Parses a db data type with optional precision or precision and scale information
get_pipeline_state_query_columns
def get_pipeline_state_query_columns() -> TTableSchema
We get definition of pipeline state table without columns we do not need for the query
verify_unsupported_merge_options
def verify_unsupported_merge_options(
schema: Schema, load_tables: Sequence[PreparedTableSchema],
capabilities: DestinationCapabilitiesContext, target: str,
options: Sequence[str]) -> List[Exception]
Returns an exception for each merge table in load_tables that sets one of the merge
options that target (a destination type or table format) cannot apply.
verify_schema_merge_disposition
def verify_schema_merge_disposition(
schema: Schema,
load_tables: Sequence[PreparedTableSchema],
capabilities: DestinationCapabilitiesContext,
warnings: bool = True,
source_filter_placeholders: Sequence[str] = (),
destination_scope_placeholders: Sequence[
str] = MERGE_CONDITION_PLACEHOLDERS
) -> List[Exception]
Verifies the merge hints of load_tables. Verifies source_filter and destination_scope
against the placeholders that the destination expands. Returns exceptions for errors and
logs warnings.
get_deterministic_temp_table_name
def get_deterministic_temp_table_name(table_name: str, op: str) -> str
Returns table name suitable for deterministic temp table. Such table will survive disconnects and is supposed to be dropped before being filled again so we need deterministic name with very low collision prob with "data" tables