|
499 | 499 | RequestOptionsProvider, |
500 | 500 | ) |
501 | 501 | from airbyte_cdk.sources.declarative.requesters.request_path import RequestPath |
502 | | -from airbyte_cdk.sources.declarative.requesters.requester import HttpMethod |
| 502 | +from airbyte_cdk.sources.declarative.requesters.requester import HttpMethod, Requester |
503 | 503 | from airbyte_cdk.sources.declarative.resolvers import ( |
504 | 504 | ComponentMappingDefinition, |
505 | 505 | ConfigComponentsResolver, |
|
542 | 542 | ConfigRemapField, |
543 | 543 | ConfigRemoveFields, |
544 | 544 | ) |
| 545 | +from airbyte_cdk.sources.declarative.transformations.config_transformations.config_transformation import ( |
| 546 | + ConfigTransformation, |
| 547 | +) |
545 | 548 | from airbyte_cdk.sources.declarative.transformations.dpath_flatten_fields import ( |
546 | 549 | DpathFlattenFields, |
547 | 550 | KeyTransformation, |
@@ -823,9 +826,10 @@ def _collect_model_deprecations(self, model: BaseModelWithDeprecations) -> None: |
823 | 826 | def create_config_migration( |
824 | 827 | self, model: ConfigMigrationModel, config: Config |
825 | 828 | ) -> ConfigMigration: |
826 | | - transformations = [] |
827 | | - for transformation in model.transformations: |
828 | | - transformations.append(self._create_component_from_model(transformation, config)) |
| 829 | + transformations: List[ConfigTransformation] = [ |
| 830 | + self._create_component_from_model(transformation, config) |
| 831 | + for transformation in model.transformations |
| 832 | + ] |
829 | 833 |
|
830 | 834 | return ConfigMigration( |
831 | 835 | description=model.description, |
@@ -3604,24 +3608,39 @@ def _get_job_timeout() -> datetime.timedelta: |
3604 | 3608 | ) |
3605 | 3609 |
|
3606 | 3610 | def create_spec(self, model: SpecModel, config: Config, **kwargs: Any) -> Spec: |
3607 | | - config_migrations = [] |
3608 | | - config_transformations = [] |
3609 | | - config_validations = [] |
3610 | | - |
3611 | | - if model.config_normalization_rules: |
3612 | | - if model.config_normalization_rules.config_migrations: |
3613 | | - for migration in model.config_normalization_rules.config_migrations: |
3614 | | - config_migrations.append(self._create_component_from_model(migration, config)) |
3615 | | - |
3616 | | - if model.config_normalization_rules.transformations: |
3617 | | - for transformation in model.config_normalization_rules.transformations: |
3618 | | - config_transformations.append( |
3619 | | - self._create_component_from_model(transformation, config) |
3620 | | - ) |
3621 | | - |
3622 | | - if model.config_normalization_rules.validations: |
3623 | | - for validation in model.config_normalization_rules.validations: |
3624 | | - config_validations.append(self._create_component_from_model(validation, config)) |
| 3611 | + config_migrations = [ |
| 3612 | + self._create_component_from_model(migration, config) |
| 3613 | + for migration in ( |
| 3614 | + model.config_normalization_rules.config_migrations |
| 3615 | + if ( |
| 3616 | + model.config_normalization_rules |
| 3617 | + and model.config_normalization_rules.config_migrations |
| 3618 | + ) |
| 3619 | + else [] |
| 3620 | + ) |
| 3621 | + ] |
| 3622 | + config_transformations = [ |
| 3623 | + self._create_component_from_model(transformation, config) |
| 3624 | + for transformation in ( |
| 3625 | + model.config_normalization_rules.transformations |
| 3626 | + if ( |
| 3627 | + model.config_normalization_rules |
| 3628 | + and model.config_normalization_rules.transformations |
| 3629 | + ) |
| 3630 | + else [] |
| 3631 | + ) |
| 3632 | + ] |
| 3633 | + config_validations = [ |
| 3634 | + self._create_component_from_model(validation, config) |
| 3635 | + for validation in ( |
| 3636 | + model.config_normalization_rules.validations |
| 3637 | + if ( |
| 3638 | + model.config_normalization_rules |
| 3639 | + and model.config_normalization_rules.validations |
| 3640 | + ) |
| 3641 | + else [] |
| 3642 | + ) |
| 3643 | + ] |
3625 | 3644 |
|
3626 | 3645 | return Spec( |
3627 | 3646 | connection_specification=model.connection_specification, |
|
0 commit comments