dlt.extract.resource
with_table_name
def with_table_name(item: TDataItems, table_name: str) -> DataItemWithMeta
Marks item to be dispatched to table table_name when yielded from resource function.
with_hints
def with_hints(item: TDataItems,
hints: TResourceHints = None,
create_table_variant: bool = False) -> DataItemWithMeta
Marks item to update the resource with specified hints.
Will create a separate variant of hints for a table if name is provided in hints and create_table_variant is set.
Create TResourceHints with make_hints.
Setting table_name will dispatch the item to a specified table, like with_table_name
DltResource Objects
class DltResource(Iterable[TDataItem], DltResourceHints)
Implements dlt resource. Contains a data pipe that wraps a generating item and table schema that can be adjusted
source_name
Name of the source that contains this instance of the source, set when added to DltResourcesDict
section
A config section name
SPEC
A SPEC that defines signature of callable(parametrized) resource/transformer
from_data
@classmethod
def from_data(cls,
data: Any,
name: str = None,
section: str = None,
hints: TResourceHints = None,
selected: bool = True,
data_from: "DltResource" = None,
inject_config: bool = False) -> Self
Creates an instance of DltResource from compatible data with a given name and section.
Internally (in the most common case) a new instance of Pipe with name is created from data and
optionally connected to an existing pipe from_data to form a transformer (dependent resource).
If inject_config is set to True and data is a callable, the callable is wrapped in incremental and config
injection wrappers.
custom_metrics
@property
def custom_metrics() -> Dict[str, Any]
Customizable resource metrics
name
@property
def name() -> str
Resource name inherited from the pipe
with_name
def with_name(new_name: str, new_section: str = None) -> Self
Clones the resource with a new name. Such resource keeps separate state and loads data to new_name table by default.
is_transformer
@property
def is_transformer() -> bool
Checks if the resource is a transformer that takes data from another resource
requires_args
@property
def requires_args() -> bool
Checks if resource has unbound arguments
incremental
@property
def incremental() -> Optional[IncrementalResourceWrapper]
Gets incremental transform if it is in the pipe
limit
@property
def limit() -> Optional[LimitItem]
Gets limit of pages/items on the resource
validator
@property
def validator() -> Optional[ValidateItem]
Gets validator transform if it is in the pipe
validator
@validator.setter
def validator(validator: Optional[ValidateItem]) -> None
Add/remove or replace the validator in pipe
max_table_nesting
@property
def max_table_nesting() -> Optional[int]
A schema hint for resource that sets the maximum depth of nested table above which the remaining nodes are loaded as structs or JSON.