|  | 
| 25 | 25 |     InvalidDestinationReference, | 
| 26 | 26 |     UnknownDestinationModule, | 
| 27 | 27 | ) | 
| 28 |  | -from dlt.common.destination.client import DestinationClientConfiguration, JobClientBase | 
|  | 28 | +from dlt.common.destination.client import ( | 
|  | 29 | +    DestinationClientConfiguration, | 
|  | 30 | +    JobClientBase, | 
|  | 31 | +    DestinationTypeConfiguration, | 
|  | 32 | +) | 
| 29 | 33 | from dlt.common.runtime.run_context import get_plugin_modules | 
| 30 | 34 | from dlt.common.schema.schema import Schema | 
| 31 | 35 | from dlt.common.typing import is_subclass | 
| @@ -267,9 +271,30 @@ def from_reference( | 
| 267 | 271 |                 ) | 
| 268 | 272 |             return ref | 
| 269 | 273 | 
 | 
| 270 |  | -        return DestinationReference.from_reference( | 
| 271 |  | -            ref, credentials, destination_name, environment, **kwargs | 
| 272 |  | -        ) | 
|  | 274 | +        try: | 
|  | 275 | +            return DestinationReference.from_reference( | 
|  | 276 | +                ref, credentials, destination_name, environment, **kwargs | 
|  | 277 | +            ) | 
|  | 278 | +        except UnknownDestinationModule: | 
|  | 279 | +            if destination_name or "." in ref: | 
|  | 280 | +                raise | 
|  | 281 | + | 
|  | 282 | +            resolved_config = resolve_configuration( | 
|  | 283 | +                DestinationTypeConfiguration(), | 
|  | 284 | +                sections=(known_sections.DESTINATION, ref), | 
|  | 285 | +                accept_partial=True, | 
|  | 286 | +            ) | 
|  | 287 | +            destination_type = getattr(resolved_config, "destination_type", None) | 
|  | 288 | +            if not destination_type: | 
|  | 289 | +                raise | 
|  | 290 | + | 
|  | 291 | +            return DestinationReference.from_reference( | 
|  | 292 | +                ref=resolved_config.destination_type, | 
|  | 293 | +                credentials=credentials, | 
|  | 294 | +                destination_name=ref, | 
|  | 295 | +                environment=environment, | 
|  | 296 | +                **kwargs, | 
|  | 297 | +            ) | 
| 273 | 298 | 
 | 
| 274 | 299 | 
 | 
| 275 | 300 | class DestinationReference: | 
|  | 
0 commit comments