Created
June 20, 2021 11:22
-
-
Save ishritam/66e9114b96c5e552e248253482986e13 to your computer and use it in GitHub Desktop.
ETL_zalando_transform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def transform_data(ti) -> None: | |
data = ti.xcom_pull(key='extracted_data', task_ids=['extract_data'])[0] | |
transformed_data = [] | |
for item in data: | |
transformed_data.append({ | |
'sku': item.get("sku", ""), | |
'Name': item['name'], | |
'Price': item['price'].get("original"), | |
'Brand Name': item['brand_name'], | |
'Thumbnail': f"https://img01.ztat.net/article/{item['media'][0]['path']}", | |
'Product URL': f"https://www.zalando.co.uk/{item['url_key']}.html" | |
}) | |
ti.xcom_push(key='transformed_data', value=transformed_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment