You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""A decorator that transforms a function that takes two positional arguments "table" and "items" and any number of keyword arguments with defaults
77
-
into a callable that will create a custom destination. The function does not return anything, the keyword arguments can be configuration and secrets values.
>>> p = dlt.pipeline("chess_pipeline", destination=my_destination)
87
-
88
-
Here all incoming data will be sent to the destination function with the items in the requested format and the dlt table schema.
89
-
The config and secret values will be resolved from the path destination.my_destination.api_url and destination.my_destination.api_secret.
127
+
>>> dest = dlt.destination(my_destination, batch_size=100, loader_file_format="parquet")
128
+
>>> p = dlt.pipeline("chess_pipeline", destination=dest)
90
129
91
130
Args:
92
-
func (Optional[AnyFun]): A function that takes two positional arguments "table" and "items" and any number of keyword arguments with defaults which will process the incoming data.
A callable that takes two positional arguments "items" and "table",
133
+
followed by any number of keyword arguments with default values. This function
134
+
will process the incoming data and does not need to return anything. The keyword
135
+
arguments can represent configuration or secret values.
93
136
94
-
loader_file_format (TLoaderFileFormat): defines in which format files are stored in the load package before being sent to the destination function, this can be puae-jsonl or parquet.
137
+
loader_file_format (TLoaderFileFormat): Defines the format in which files are stored in the load package
138
+
before being sent to the destination function.
95
139
96
-
batch_size (int): defines how many items per function call are batched together and sent as an array. If you set a batch-size of 0, instead of passing in actual dataitems, you will receive one call per load job with the path of the file as the items argument. You can then open and process that file in any way you like.
140
+
batch_size (int): Defines how many items per function call are batched together and sent as an array.
141
+
If set to 0, instead of passing actual data items, you will receive one call per load job
142
+
with the path of the file as the "items" argument. You can then open and process that file as needed.
143
+
144
+
name (str): Defines the name of the destination created by the destination decorator.
145
+
Defaults to the name of the function.
146
+
147
+
naming_convention (str): Controls how table and column names are normalized.
148
+
The default value, "direct", keeps all names unchanged.
149
+
150
+
skip_dlt_columns_and_tables (bool): Defines whether internal dlt tables and columns
151
+
are included in the custom destination function. Defaults to True.
152
+
153
+
max_table_nesting (int): Defines how deep the normalizer will go to flatten nested fields
154
+
in your data to create subtables. This overrides any source settings and defaults to 0,
155
+
meaning no nested tables are created.
156
+
157
+
spec (Type[CustomDestinationClientConfiguration]): Defines a configuration spec used
158
+
to inject arguments into the decorated function. Arguments not included in the spec will not be injected.
159
+
160
+
max_parallel_load_jobs (Optional[int]): Defines the maximum number of load jobs
161
+
that can run concurrently during the load process.
162
+
163
+
loader_parallelism_strategy (Optional[TLoaderParallelismStrategy]): Determines the load job parallelism strategy.
164
+
Can be "sequential" (equivalent to max_parallel_load_jobs=1), "table-sequential" (one load job per table at a time),
165
+
or "parallel".
166
+
167
+
Returns:
168
+
Callable[TDestinationCallableParams, _destination]: A callable that can be used to create a custom dlt destination instance.
169
+
"""
170
+
...
97
171
98
-
name (str): defines the name of the destination that gets created by the destination decorator, defaults to the name of the function
99
172
100
-
naming_convention (str): defines the name of the destination that gets created by the destination decorator. This controls how table and column names are normalized. The default is direct which will keep all names the same.
173
+
@overload
174
+
defdestination(
175
+
destination_name: str,
176
+
/,
177
+
*,
178
+
destination_type: Optional[str] =None,
179
+
credentials: Optional[Any] =None,
180
+
**kwargs: Any,
181
+
) ->AnyDestination:
182
+
"""Instantiates a destination from the provided destination name and type by retrieving the corresponding
183
+
destination factory and initializing it with the given credentials and keyword arguments.
101
184
102
-
skip_dlt_columns_and_tables (bool): defines wether internal tables and columns will be fed into the custom destination function. This is set to True by default.
185
+
Args:
186
+
destination_name (str): The name of the destination instance to initialize.
103
187
104
-
max_table_nesting (int): defines how deep the normalizer will go to normalize nested fields on your data to create subtables. This overwrites any settings on your source and is set to zero to not create any nested tables by default.
188
+
destination_type (Optional[str]): The type of the destination to instantiate.
105
189
106
-
spec (Type[CustomDestinationClientConfiguration]): defines a configuration spec that will be used to to inject arguments into the decorated functions. Argument not in spec will not be injected
190
+
credentials (Optional[Any]): Credentials used to connect to the destination.
191
+
May be an instance of a credential class supported by the respective destination.
107
192
108
-
max_parallel_load_jobs (Optional[int]): how many load jobs at most will be running during the load
193
+
**kwargs (Any): Additional keyword arguments passed to the destination factory.
109
194
110
-
loader_parallelism_strategy (Optional[TLoaderParallelismStrategy]): Can be "sequential" which equals max_parallel_load_jobs=1, "table-sequential" where each table will have at most one loadjob at any given time and "parallel"
111
195
Returns:
112
-
Any: A callable that can be used to create a dlt custom destination instance
0 commit comments