Skip to content

soumilshah1995/source-to-target-mapping-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

source-to-target-mapping-python


Classes

image

#DB Design etl (1)

Sample Input

    json_incoming_data = {
        "jobTitle": "SOFTWARE ENGINEER         ",
        "Salary": "70000",
        "Company": "ABC "
    }

Source Target and Transform and Mappings

{
            "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,
                }
            ]
        }

sample code


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

Watch Videos


  • 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

About

source to target mapping python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages