Skip to main content
Version: 0.3.25

extract.hints

make_hints

def make_hints(
table_name: TTableHintTemplate[str] = None,
parent_table_name: TTableHintTemplate[str] = None,
write_disposition: TTableHintTemplate[TWriteDisposition] = None,
columns: TTableHintTemplate[TAnySchemaColumns] = None,
primary_key: TTableHintTemplate[TColumnNames] = None,
merge_key: TTableHintTemplate[TColumnNames] = None,
schema_contract: TTableHintTemplate[TSchemaContract] = None,
table_format: TTableHintTemplate[TTableFormat] = None
) -> TResourceHints

[view_source]

A convenience function to create resource hints. Accepts both static and dynamic hints based on data.

This method accepts the same table hints arguments as dlt.resource decorator.

DltResourceHints Objects

class DltResourceHints()

[view_source]

table_name

@property
def table_name() -> TTableHintTemplate[str]

[view_source]

Get table name to which resource loads data. May return a callable.

columns

@property
def columns() -> TTableHintTemplate[TTableSchemaColumns]

[view_source]

Gets columns' schema that can be modified in place

compute_table_schema

def compute_table_schema(item: TDataItem = None) -> TTableSchema

[view_source]

Computes the table schema based on hints and column definitions passed during resource creation. item parameter is used to resolve table hints based on data.

apply_hints

def apply_hints(
table_name: TTableHintTemplate[str] = None,
parent_table_name: TTableHintTemplate[str] = None,
write_disposition: TTableHintTemplate[TWriteDisposition] = None,
columns: TTableHintTemplate[TAnySchemaColumns] = None,
primary_key: TTableHintTemplate[TColumnNames] = None,
merge_key: TTableHintTemplate[TColumnNames] = None,
incremental: Incremental[Any] = None,
schema_contract: TTableHintTemplate[TSchemaContract] = None,
additional_table_hints: Optional[Dict[str,
TTableHintTemplate[Any]]] = None,
table_format: TTableHintTemplate[TTableFormat] = None) -> None

[view_source]

Creates or modifies existing table schema by setting provided hints. Accepts both static and dynamic hints based on data.

This method accepts the same table hints arguments as dlt.resource decorator with the following additions. Skip the argument or pass None to leave the existing hint. Pass empty value (for a particular type i.e. "" for a string) to remove a hint.

parent_table_name (str, optional): A name of parent table if foreign relation is defined. Please note that if you use merge, you must define root_key columns explicitly incremental (Incremental, optional): Enables the incremental loading for a resource.

Please note that for efficient incremental loading, the resource must be aware of the Incremental by accepting it as one if its arguments and then using are to skip already loaded data. In non-aware resources, dlt will filter out the loaded values, however, the resource will yield all the values again.

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.