Skip to content

Instantly share code, notes, and snippets.

@ishritam
Created June 20, 2021 11:22
Show Gist options
  • Save ishritam/66e9114b96c5e552e248253482986e13 to your computer and use it in GitHub Desktop.
Save ishritam/66e9114b96c5e552e248253482986e13 to your computer and use it in GitHub Desktop.
ETL_zalando_transform
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