Skip to main content
Version: devel

dlt.common.destination.reference

Destination Objects

class Destination(ABC, Generic[TDestinationConfig, TDestinationClient])

View source on GitHub

A destination factory that can be partially pre-configured with credentials and other config params.

config_params

Explicit config params, overriding any injected or default values.

caps_params

Explicit capabilities params, overriding any default values for this destination

spec

@property
@abstractmethod
def spec() -> Type[TDestinationConfig]

View source on GitHub

A spec of destination configuration that also contains destination credentials

capabilities

def capabilities(
config: Optional[TDestinationConfig] = None,
naming: Optional[NamingConvention] = None
) -> DestinationCapabilitiesContext

View source on GitHub

Destination capabilities ie. supported loader file formats, identifier name lengths, naming conventions, escape function etc. Explicit caps arguments passed to the factory init and stored in caps_params are applied.

If config is provided, it is used to adjust the capabilities, otherwise the explicit config composed just of config_params passed to factory init is applied If naming is provided, the case sensitivity and case folding are adjusted.

destination_name

@property
def destination_name() -> str

View source on GitHub

The destination name will either be explicitly set while creating the destination or will be taken from the type

configured_name

@property
def configured_name() -> str

View source on GitHub

Configured destination name, None by default

client_class

@property
@abstractmethod
def client_class() -> Type[TDestinationClient]

View source on GitHub

A job client class responsible for starting and resuming load jobs

configuration

def configuration(initial_config: TDestinationConfig,
accept_partial: bool = False) -> TDestinationConfig

View source on GitHub

Get a fully resolved destination config from the initial config

client

def client(schema: Schema,
initial_config: TDestinationConfig = None) -> TDestinationClient

View source on GitHub

Returns a configured instance of the destination's job client

adjust_capabilities

@classmethod
def adjust_capabilities(
cls, caps: DestinationCapabilitiesContext, config: TDestinationConfig,
naming: Optional[NamingConvention]) -> DestinationCapabilitiesContext

View source on GitHub

Adjust the capabilities to match the case sensitivity as requested by naming convention.

register

@classmethod
def register(cls) -> None

View source on GitHub

Registers this factory class under module.name of a Destination factory

from_reference

@classmethod
def from_reference(cls,
ref: TDestinationReferenceArg,
credentials: Optional[Any] = None,
destination_name: Optional[str] = None,
environment: Optional[str] = None,
**kwargs: Any) -> Optional[AnyDestination]

View source on GitHub

Instantiate destination from a string reference or one of supported forms. This methods obtains a destination factory and then instantiates it passing the arguments after ref

DestinationReference Objects

class DestinationReference()

View source on GitHub

A registry of destination factories with a set of method for finding and instantiating

DESTINATIONS

A registry of all the destination factories

normalize_type

@staticmethod
def normalize_type(destination_type: str) -> str

View source on GitHub

Normalizes destination type string into a canonical form. Assumes that type names without dots correspond to built in destinations.

register

@classmethod
def register(cls, factory: Type[AnyDestination_CO], ref: str) -> None

View source on GitHub

Registers factory class under ref. ref

to_fully_qualified_refs

@staticmethod
def to_fully_qualified_refs(ref: str) -> List[str]

View source on GitHub

Converts ref into fully qualified form, return one or more alternatives for shorthand notations. Run context is injected if needed. Following formats are recognized

  • name NOTE: the last component of destination type serves as destination name if not explicitly specified

find

@classmethod
def find(
cls,
ref: str,
raise_exec_errors: bool = False,
import_missing_modules: bool = False
) -> Union[Type[AnyDestination], Callable[..., AnyDestination]]

View source on GitHub

Finds or auto-imports destination factory that can be further called in order to instantiate it The ref can be a destination name or import path pointing to a destination class (e.g. dlt.destinations.postgres) You can control auto-import behavior:

  • raise_exec_errors - will re-raise code execution errors in imported modules
  • import_missing_modules - will ignore missing dependencies during import by substituting them with dummy modules. this should be only used to manipulate local dev environment

NOTE: find returns a factory class or a callable that will create factory instance (for custom destinations) use ensure_factory to extract factory class from callable TODO: synthesize a call on custom destination (destination) factory type so this distinction is not needed

ensure_factory

@classmethod
def ensure_factory(
cls, ref_factory: Union[Type[AnyDestination], Callable[...,
AnyDestination]]
) -> Type[AnyDestination]

View source on GitHub

Extract factory type from a callable creating factory instance.

from_reference

@classmethod
def from_reference(cls,
ref: str,
credentials: Optional[Any] = None,
destination_name: Optional[str] = None,
environment: Optional[str] = None,
**kwargs: Any) -> Optional[AnyDestination]

View source on GitHub

Instantiate destination from str reference. The ref can be a destination name or import path pointing to a destination class (e.g. dlt.destinations.postgres) This methods obtains a destination factory and then instantiates it passing the arguments after ref

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.