https://github.com/soumilshah1995/source-to-target-mapping-python
source to target mapping python
https://github.com/soumilshah1995/source-to-target-mapping-python
Last synced: 4 months ago
JSON representation
source to target mapping python
- Host: GitHub
- URL: https://github.com/soumilshah1995/source-to-target-mapping-python
- Owner: soumilshah1995
- License: apache-2.0
- Created: 2022-10-26T16:55:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-21T22:36:45.000Z (about 2 years ago)
- Last Synced: 2024-08-14T07:09:18.144Z (8 months ago)
- Language: Python
- Size: 44.9 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - soumilshah1995/source-to-target-mapping-python - source to target mapping python (Python)
README
# source-to-target-mapping-python
-----------------------------------------------------------------------------# Classes
#DB Design
# 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
* 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