hallowed-machine-2603
07/12/2022, 4:29 AMbetter-orange-49102
07/12/2022, 11:25 AMIf you don't want the environment but wanted to add something static in the browse path like the database instance name you can use this.
transformers:
- type: "set_dataset_browse_path"
config:
path_templates:
- /PLATFORM/marketing_db/DATASET_PARTS
It will create browse path like `/mysql/marketing_db/sales/orders` for a table `sales.orders` in `mysql` database instance.
for (2), are you trying to add the same properties to each dataset or different properties?hallowed-machine-2603
07/14/2022, 4:35 AMbetter-orange-49102
07/14/2022, 5:56 AMbetter-orange-49102
07/14/2022, 5:58 AM### Adding a set of properties
If you'd like to add more complex logic for assigning properties, you can use the `add_dataset_properties` transformer, which calls a user-provided class (that extends from `AddDatasetPropertiesResolverBase` class) to determine the properties for each dataset.
The config, which we'd append to our ingestion recipe YAML, would look like this:
```yaml
transformers:
- type: "add_dataset_properties"
config:
add_properties_resolver_class: "<your_module>.<your_class>"
Then define your class to return a list of custom properties, for example:
python
import logging
from typing import Dict
from datahub.ingestion.transformer.add_dataset_properties import AddDatasetPropertiesResolverBase
from datahub.metadata.schema_classes import DatasetSnapshotClass
class MyPropertiesResolver(AddDatasetPropertiesResolverBase):
def get_properties_to_add(self, current: DatasetSnapshotClass) -> Dict[str, str]:
### Add custom logic here
properties= {'my_custom_property': 'property value'}
<http://logging.info|logging.info>(f"Adding properties: {properties} to dataset: {current.urn}.")
return properties
There also exists simple_add_dataset_properties
transformer for directly assigning properties from the configuration.
properties
field is a dictionary of string values. Note in case of any key collision, the value in the config will
overwrite the previous value.```