json_incoming_data = {
"jobTitle": "SOFTWARE ENGINEER ",
"Salary": "70000",
"Company": "ABC "
}
{
"source": [
{
"id": 1,
"source_field_name": "jobTitle",
"source_field_mapping": "$.jobTitle",
"source_field_type": "str",
"is_required": True,
},
{
"id": 2,
"source_field_name": "Salary",
"source_field_mapping": "$.Salary",
"source_field_type": "str",
"is_required": True,
}
],
"destination": [
{
"id": 1,
"destination_field_name": "job_title",
"destination_field_mapping": "job_title",
"destination_field_type": "str",
"default_value": "n/a",
},
{
"id": 2,
"destination_field_name": "salary",
"destination_field_mapping": "salary",
"destination_field_type": "float",
"default_value": "0"
}
],
"transform": [
{
"id": 1,
"transform_mask": 'CLEAN_STRING'
}
],
"mapping": [
{
"id": 1,
"mapping_source": 1,
"mapping_destination": 1,
"mapping_transform": 1
},
{
"id": 2,
"mapping_source": 2,
"mapping_destination": 2,
}
]
}
def main():
"""incoming JSON Reader"""
json_incoming_data = {
"jobTitle": "SOFTWARE ENGINEER ",
"Salary": "70000",
"Company": "Soumil LLC "
}
helper = Client(input_json=json_incoming_data)
response = helper.get_transformed_data()
print(response)
main()
- Note i am mocking data from database. databse tables design are given above
- https://www.youtube.com/watch?v=dD0ldxzwZh4&t=2s
- https://www.youtube.com/watch?v=SwXWpR4iK70&feature=youtu.be
- This is quite clever because it performs all data type checks and whenever the source data types change from the source table's definitions, the process or job will raise an exception. Additionally, it converts data types. For example, if you declared a string in the source and wanted to convert it to a float in the target, Python templates will do it for you automatically. it also has features where if the value is none it can replace with defult values that you specify
Smart way to Capture Jobs and Process Meta Data Using DynamoDB | Project Demo | Python Templates | Alerts https://github.com/soumilshah1995/Smart-way-to-Capture-Jobs-and-Process-Meta-Data-Using-DynamoDB-Project-Demo-Python-Templates