def get_connection_connector(self) -> dict: config = self.get_config_parser() context = generate_template_context(execution_date=datetime.now(), connection=self, **config[self.type]) output = Template(self.connector).render(**context) return load_yaml(output)
def get_transform_name_format(self, resource_name: 'ResourceName', **kwargs) -> str: self.check_system_type() source_type, target_type = self.source.type.code, self.target.type.code return Template(self.get_config('transform_name_format')).render( generate_template_context(source_type=source_type, target_type=target_type, resource_name=resource_name, connector=self, **kwargs))
def get_connection_connector(self) -> dict: config = self.resource_name.get_config_parser() context = generate_template_context(execution_date=datetime.now(), connection=self.connection, schema=self.schema_version, tempalte=self.template, resource_name=self.resource_name, version=self, **config[self.connection.type]) output = Template(self.connection.connector).render(**context) return load_yaml(output)
def handle_template(text: Optional[str], args: dict) -> str: return Template(text).render(**generate_template_context(**args)) if text else ''