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
QoL: accept destination name as shorthand form of destination (#3122)
* Destination type lookup fallback in from_reference
* Test test_import_destination_type_config
* Docs adjusted, e2e test added
* e2e test with pipeline load
* first named des with type, then dest as type
* Tests fixed, exception improved, docs adjusted
* fixes plugin module list
* Code simplified
* exception just sets attrs, from_name removed
---------
Co-authored-by: Marcin Rudolf <rudolfix@rudolfix.org>
Above, we use a custom destination name and configure the destination type to **filesystem** using an environment variable.
25
+
26
+
:::note
27
+
When resolving non-module destination references (e.g., `"filesystem"` or `"my_destination"`, not `"dlt.destinations.filesystem"`), dlt first attempts to resolve the reference as a named destination with a valid destination type configured, then falls back to shorthand type resolution.
28
+
29
+
This means that, in the previous example, if the destination type was not properly configured or was not a valid destination type, dlt would have attempted to resolve `"my_destination"` as a shorthand for a built-in type and would have eventually failed.
@@ -30,32 +45,34 @@ Above, we import the destination factory for **filesystem** and pass it to the p
30
45
31
46
All examples above will create the same destination class with default parameters and pull required config and secret values from [configuration](credentials/index.md) - they are equivalent.
32
47
33
-
34
-
### Pass explicit parameters and a name to a destination
48
+
### Pass explicit parameters and a name to a destination factory
35
49
You can instantiate the **destination factory** yourself to configure it explicitly. When doing this, you work with destinations the same way you work with [sources](source.md)
Above, we import and instantiate the `filesystem` destination factory. We pass the explicit URL of the bucket and name the destination `production_az_bucket`.
39
53
40
-
If a destination is not named, its shorthand type (the Python factory name) serves as a destination name. Name your destination explicitly if you need several separate configurations of destinations of the same type (i.e., you wish to maintain credentials for development, staging, and production storage buckets in the same config file). The destination name is also stored in the [load info](../running-in-production/running.md#inspect-and-save-the-load-info-and-trace) and pipeline traces, so use them also when you need more descriptive names (other than, for example,`filesystem`).
54
+
If a destination is not named, its shorthand type (the Python factory name) serves as the destination name. Name your destination explicitly if you need several separate configurations for destinations of the same type (i.e., when you wish to maintain credentials for development, staging, and production storage buckets in the same config file). The destination name is also stored in the [load info](../running-in-production/running.md#inspect-and-save-the-load-info-and-trace) and pipeline traces, so use explicit names when you need more descriptive identifiers (rather than generic names like`filesystem`).
41
55
42
56
43
57
## Configure a destination
44
58
We recommend passing the credentials and other required parameters to configuration via TOML files, environment variables, or other [config providers](credentials/setup). This allows you, for example, to easily switch to production destinations after deployment.
45
59
46
-
We recommend using the [default config section layout](credentials/advanced#organize-configuration-and-secrets-with-sections) as below:
60
+
Use the [default config section layout](credentials/advanced#organize-configuration-and-secrets-with-sections) as shown below:
For custom destination names passed to your pipeline (e.g., `destination="my_destination"`), dlt resolves the destination type from configuration. Add `destination_type` to specify which destination type to use:
Note that when you use the [`dlt init` command](../walkthroughs/add-a-verified-source.md) to create or add a data source, `dlt` creates a sample configuration for the selected destination.
0 commit comments