{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "John Leung",
  "title_listed": "Orchestrating a Dynamic Time-series Pipeline in Azure",
  "keywords": "",
  "domain": "数据处理",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://towardsdatascience.com/orchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231/",
  "publish_date": "2024-05-31",
  "corpus_stage": "",
  "notes": "",
  "id": "f6ec4f5e2450",
  "collected_at": "2026-10-02T04:26:01",
  "title": "Orchestrating a Dynamic Time-series Pipeline in Azure | Towards Data Science",
  "body_markdown": "![Revisit consent button](../images/body-df29beacd7496220cc94.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](../images/body-2159bb67f3de8ad870eb.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\n# Orchestrating a Dynamic Time-series Pipeline in Azure\nExplore how to build, trigger, and parameterize a time-series data pipeline with ADF and Databricks, accompanied by a step-by-step tutorial\n[John Leung](https://towardsdatascience.com/author/johnleungtj/)\nMay 31, 20248 min read\n# Orchestrating a Dynamic Time-Series Pipeline in Azure\n### Explore how to build, trigger, and parameterize a time-series data pipeline with Azure Data Factory (ADF) and Databricks, accompanied by a step-by-step tutorial\nIn the [previous story](https://medium.com/towards-data-science/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287), we went through the potential of PySpark on Databricks for time-series data. I encourage you to catch up [here](https://medium.com/towards-data-science/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287) to know more. Without configuring a standalone Spark instance, we can ingest static and streaming data, perform transformation, extract useful time-related features, and build visualization using PySpark on Databricks. Its scalability and performance are particularly advantageous when handling complex transformations of enterprise-level data, up to petabytes.\nAll the feature engineering tasks were successfully performed within a single Databricks notebook. However, this is only a part of the data engineering story when building a data-centric system. The core part of the data pipeline lies in data orchestration.\n> Data orchestration generally refers to have the centralized control over data flows so that we can automate, manage, and monitor the entire data pipeline.\n![Photo by Julio Rionaldo on Unsplash](../images/000.jpg)\nPhoto by [Julio Rionaldo](https://unsplash.com/@juliorionaldo?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)\n* * *\n### Azure Data Factory (ADF) with Azure Databricks\nTo satisfy these needs, one of the most popular solutions in the industry is to run [Azure Databricks](https://azure.microsoft.com/en-gb/products/databricks/#content-card-list-oc803c) notebooks from an [ADF](https://azure.microsoft.com/en-us/products/data-factory#features) platform.\nADF is a cloud-based, serverless, and fully managed data integration service. Though [Databricks Workflow](https://docs.databricks.com/en/workflows/index.html) gives a good alternative that covers some ADF features, there are still several key benefits to choosing ADF. For example, ADF is a mature tool for integrating with diverse data stores using connectors, including SaaS applications like Salesforce, and Big Data sources like Amazon Redshift, and Google BigQuery. Therefore, it works well for ingestion and integration, especially if the current system has complex dependencies with data systems outside of Databricks. Besides, ADF simplifies and facilitates the quick building of basic pipelines using a drag-and-drop and low-code interface.\n* * *\n**In this hands-on journey, we will dive deeper into the data engineering project and explore how ADF helps build a dynamic, skeletal data pipeline for time-series data.** I will demonstrate how to mount cloud storage on Azure Databricks, transform data by embedding Notebook on Azure Databricks, and dynamically orchestrate data through custom settings in ADF. Let's get started!\n### The initial setup\nThere are several cloud components and services in the first place.\n**#1 Create an Azure resource group**\nThis container is used to hold and group the resources for an Azure solution. We will place our necessary cloud service components in this logical group for easier building or deployment.\n![Azure resource group \\(Image by author\\)](../images/001.png)\nAzure resource group (Image by author)\n**#2 Create an Azure Data Lake Gen 2 storage account**\nYou can choose a suitable storage account based on the requirements of performance and replication. In the advanced tab, we enable the Hierarchical Namespace to set up the [Data Lake Storage Gen 2](https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction). This allows for storing both structured and unstructured data.\n![Storage account \\(Image by author\\)](../images/002.png)\nStorage account (Image by author)\n**#3 Set up Azure Databricks service**\nIf you have used Databricks before, Azure Databricks service is largely the same. Besides, it is natively integrated with other Azure services and provides a unified billing platform. There are two [tiers](https://azure.microsoft.com/en-us/pricing/details/databricks/): (1) Standard - sufficient for our proof-of-concept here; and (2) Premium - the features of the Standard tier, with additionally the [Unity Catalog](https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/) and the advanced networking features that may be necessary for a large enterprise with multiple Databricks workspaces.\n![Azure Databricks workspace \\(Image by author\\)](../images/003.png)\nAzure Databricks workspace (Image by author)\n**#4 Register an application**\nThis service will help mount Azure storage to Databricks, so make sure you note the application ID and tenant ID, and most importantly the app secret value, which cannot be viewed when you revisit it.\n![App registration - Setting \\(Image by author\\)](../images/004.png)\nApp registration - Setting (Image by author)\n![App registration - Info \\(Image by author\\)](../images/005.png)\nApp registration - Info (Image by author)\n![App registration - Client secret \\(Image by author\\)](../images/006.png)\nApp registration - Client secret (Image by author)\nAfterward, grant the app service access rights to the app service. This is achieved by assigning the \"Storage Blob Data Contributor\" role to the app we just registered.\n![Storage account - Grant access right \\(1/3\\) \\(Image by author\\)](../images/007.png)\nStorage account - Grant access right (1/3) (Image by author)\n![Storage account - Grant access right \\(2/3\\) \\(Image by author\\)](../images/008.png)\nStorage account - Grant access right (2/3) (Image by author)\n![Storage account - Grant access right \\(3/3\\) \\(Image by author\\)](../images/009.png)\nStorage account - Grant access right (3/3) (Image by author)\n**#5 Create Azure SQL Database**\nTo store a transformed data frame, we search for Azure SQL resources and pick a \"Single database\" as the resource type. There are choices of SQL database servers with different computing hardware, maximum data size, and more. You can instantly get the estimated cost summary while adjusting the server specifications.\n![Create SQL Database \\(1/2\\) \\(Image by author\\)](../images/010.png)\nCreate SQL Database (1/2) (Image by author)\n![Create SQL Database \\(2/2\\) \\(Image by author\\)](../images/011.png)\nCreate SQL Database (2/2) (Image by author)\nAfter all the initial setups, you are ready to explore how these services are linked together.\n### Prepare for data orchestrating pipeline\n**#1 Ingest data**\nWe first upload the electric power consumption data to Azure Data Lake Gen2. This [dataset](https://www.kaggle.com/datasets/uciml/electric-power-consumption-data-set/data) [with license as [Database: Open Database, Contents: Database Contents](https://opendatacommons.org/licenses/dbcl/1-0/)], obtained from Kaggle, is sampled at a one-minute rate from December 2006 to November 2010.\n![Upload input data \\(Image by author\\)](../images/012.png)\nUpload input data (Image by author)\nNext, we create a Notebook on the Azure Databricks workspace and mount storage by defining the parameters using previously stored ID values.\npython\n\n```\n# Define the configuration specifications\nconfigs = {\"fs.azure.account.auth.type\": \"OAuth\",\n\"fs.azure.account.oauth.provider.type\": \"org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider\",\n\"fs.azure.account.oauth2.client.id\": \"<Client ID>\",\n\"fs.azure.account.oauth2.client.secret\": \"<Client Secret>\",\n\"fs.azure.account.oauth2.client.endpoint\": \"https://login.microsoftonline.com/<Tenant ID>/oauth2/token\"\n}\n\ndbutils.fs.mount(\n  source = \"abfss://input@adlstsdp.dfs.core.windows.net/\", # URI of the object storage\n  mount_point = \"/mnt/adlstsdp/input\",  # local path in the /mnt directory\n  extra_configs = configs)\n```\n\nTo verify file access, we can run the following command:\npython\n\n```\ndbutils.fs.ls(\"/mnt/adlstsdp/input\")\n\n# Output: [FileInfo(path='dbfs:/mnt/adlstsdp/input/household_power_consumption.csv', name='household_power_consumption.csv', size=132960755, modificationTime=1716798010000)]\n```\n\n**#2 Embed Notebook on Azure Databricks**\nMost of the source codes in this section build upon my [previous story](https://towardsdatascience.com/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287). The idea is to perform data cleansing, transformation, and feature engineering (create time-related and moving averaging features). The transformed data is ultimately written to the Azure database table.\nYou can check the complete code below to see the implementation.\npython\n\n```\n# Define file location, file typem and CSV options\nfile_location = \"/mnt/adlstsdp/input/household_power_consumption.csv\"\nfile_type = \"csv\"\nschema = \"Date STRING, Time STRING, Global_active_power DOUBLE, Global_reactive_power DOUBLE, Voltage DOUBLE, Global_intensity DOUBLE, Sub_metering_1 DOUBLE, Sub_metering_2 DOUBLE, Sub_metering_3 DOUBLE\"\nfirst_row_is_header = \"true\"\ndelimiter = \";\"\n\n# Read CSV files\norg_df = spark.read.format(file_type) \n  .schema(schema) \n  .option(\"header\", first_row_is_header) \n  .option(\"delimiter\", delimiter) \n  .load(file_location)\n\n# Data cleansing and transformation\nfrom pyspark.sql.functions import *\ncleaned_df = org_df.na.drop()\ncleaned_df = cleaned_df.withColumn(\"Date\", to_date(col(\"Date\"),\"d/M/y\"))\ncleaned_df = cleaned_df.withColumn(\"Date\", cleaned_df[\"Date\"].cast(\"date\"))\ncleaned_df = cleaned_df.select(concat_ws(\" \", to_date(col(\"Date\"),\"d/M/y\"), col(\"Time\")).alias(\"DateTime\"), \"*\")\ncleaned_df = cleaned_df.withColumn(\"DateTime\", cleaned_df[\"DateTime\"].cast(\"timestamp\"))\ndf = cleaned_df.groupby(\"Date\").agg(\n    round(sum(\"Global_active_power\"), 2).alias(\"Total_global_active_power\"),\n    ).sort([\"Date\"])\n\n# Add time-related features\ndf = df.withColumn(\"year\", year(\"Date\"))\ndf = df.withColumn(\"month\", month(\"Date\"))\ndf = df.withColumn(\"week_num\", weekofyear(\"Date\"))\n\n# Add lagged value features of total global active power\nfrom pyspark.sql.window import Window\nfrom pyspark.sql.functions import lag\n\nwindowSpec = Window.orderBy(\"Date\")\ndf = df.withColumn(\"power_lag1\", round(lag(col(\"Total_global_active_power\"), 1).over(windowSpec), 2))\n\n# Create delta field\ndf = df.withColumn(\"power_lag1_delta\", round(col(\"power_lag1\") - col(\"Total_global_active_power\"), 2))\n\n# Create window average fields\ndef add_window_avg_fields(df, window_sizes):\n    for idx, window_size in enumerate(window_sizes, start=1):\n        window_col_name = f\"avg_power_lag_{idx}\"\n        windowSpec = Window.orderBy(\"Date\").rowsBetween(-window_size, 0)\n        df = df.withColumn(window_col_name, round(avg(col(\"Total_global_active_power\")).over(windowSpec), 2))\n    return df\n\nwindow_sizes = [14, 30]\ndf = add_window_avg_fields(df, window_sizes)\n\n# Create Exponentially Weighted Moving Average (EWMA) fields\nimport pyspark.pandas as ps\nps.set_option('compute.ops_on_diff_frames', True)\n\ndef add_ewma_fields(df, alphas):\n    for idx, alpha in enumerate(alphas, start=1):\n        ewma_col_name = f\"ewma_power_weight_{idx}\"\n        windowSpec = Window.orderBy(\"Date\")\n        df[ewma_col_name] = df.Total_global_active_power.ewm(alpha=alpha).mean().round(2)\n    return df\n\nalphas = [0.2, 0.8]\ndf_pd = df.pandas_api()\ndf_pd = add_ewma_fields(df_pd, alphas)\ndf = df_pd.to_spark()\n\n# Write transformed dataframe to the database table \"electric_usage_table\"\ndf.write.format(\"jdbc\") \n    .option(\"url\", \"jdbc:sqlserver://sql-db-dp.database.windows.net:1433;databaseName=sql-db-dp\") \n    .option(\"dbtable\", \"dbo.electric_usage_table\") \n    .option(\"user\", \"<username>\") \n    .option(\"password\", \"<password>\") \n    .mode(\"overwrite\")  \n    .save()\n```\n\n**#3 Build a basic pipeline in ADF**\nIn ADF, we add a \"Notebook\" activity to the pipeline environment, then configure it to reference the desired Notebook in the Databricks folder. Set up the Databricks linked service, then validate and publish the entire activity pipeline in ADF. You can then run the pipeline in \"Debug\" mode.\n![The success status of pipeline run \\(Image by author\\)](../images/013.png)\nThe success status of pipeline run (Image by author)\nThe activity status shows \"Succeeded\", meaning the data should be migrated and inserted into the Azure SQL Database table. We can view the results for verification using the query editor.\n![Query result of the Azure SQL database \\(Image by author\\)](../images/014.png)\nQuery result of the Azure SQL database (Image by author)\n**#4 Automate the pipeline**\nADF offers functionalities that are far beyond the above simple implementation. For example, we can automate the pipeline by creating a [storage-based event trigger](https://learn.microsoft.com/en-us/azure/data-factory/how-to-create-event-trigger?tabs=data-factory). Make sure that `Microsoft.EventGrid` is registered as one of the resource providers in your account subscription, then set up the trigger: Whenever a new dataset is uploaded to the storage account, the pipeline will automatically execute.\n![Set a new trigger in ADF \\(Image by author\\)](../images/body-8f4967053f007838d640.png)\nSet a new trigger in ADF (Image by author)\nThis type of trigger has various use cases in the industries, such as monitoring the inventory level to replenish orders for the supply chain or tracking customer interactions for personalized recommendations in digital marketing.\n**#5 Parameterize the Notebook variables**\nTo take a further step to build a more dynamic data pipeline, we can make variables more parametric. For example, during feature engineering on time-series data, the window size of data features may not be optimized initially. The window sizes may need to be adjusted to capture seasonal patterns or based on downstream model fine-tuning. For this scenario, we can amend with the below settings.\n![Set up parameters for pipeline run \\(Image by author\\)](../images/body-31473e0a64ce018f6255.png)\nSet up parameters for pipeline run (Image by author)\nIn the Notebook, add the code below to create a widget that can get the parameters input from the ADF pipeline:\npython\n\n```\n# Additional code: Access the current value of the widget\ninputWindowSizes = dbutils.widgets.get(\"inputWindowSizes\")\nwindow_sizes = inputWindowSizes.split(\",\")\n\n# Original function for adding window average features\ndf = add_window_avg_fields(df, window_sizes)\n```\n\nAfter adjusting the settings and the Notebook codes, we can run the pipeline by providing the window size parameter values, such as 30 and 60.\n![Input window size value for pipeline run \\(Image by author\\)](../images/body-3004a14ff621cd5a60ba.png)\nInput window size value for pipeline run (Image by author)\nFinally, we can monitor the pipeline status again using ADF or Databricks workspace.\n### Wrapping it up\nIn our hands-on exploration, we mainly used ADF with Azure Databricks to orchestrate a dynamic time-series data pipeline:\n  * Setup the cloud resources for the compute, analytics, and storage\n  * Build the skeleton of the data pipeline from data ingestion to storage\n  * Bring flexibilities to the pipeline by creating triggers and parameterizing variables\n\n\nAt the enterprise level, more [complex cloud architectures](https://medium.com/@johnleungTJ/how-to-design-the-ai-architectures-in-azure-for-the-new-era-9531229cfd33) may be implemented to satisfy evolving needs, such as streaming data, model monitoring, and multi-model pipelines. It thus becomes essential to strive for a delicate balance between performance, reliability, and cost-efficiency through team collaboration on governance policies and spending management.\n* * *\n### Before you go\nIf you enjoy this reading, I invite you to **** follow my [Medium page](https://medium.com/@johnleungTJ) and [LinkedIn page](https://www.linkedin.com/in/john-leung-639800115/). By doing so, you can stay updated with exciting content related to data science side projects and Machine Learning Operations (MLOps) demonstration methodologies.\n> [**Performing Customer Analytics with LangChain and LLMs**](https://towardsdatascience.com/performing-customer-analytics-with-langchain-and-llms-0af4ea38f7b5)\n> [**Managing the Technical Debts of Machine Learning Systems**](https://towardsdatascience.com/managing-the-technical-debts-of-machine-learning-systems-5b85d420ab9d)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](../images/body-4766f66da8cde6940868.jpeg)\nWritten By\n## [John Leung](https://towardsdatascience.com/author/johnleungtj/)\n[See all from John Leung](https://towardsdatascience.com/author/johnleungtj/)\n[Azure](https://towardsdatascience.com/tag/azure/)[Big Data](https://towardsdatascience.com/tag/big-data/)[Data Engineering](https://towardsdatascience.com/tag/data-engineering/)[Databricks](https://towardsdatascience.com/tag/databricks/)[Spark](https://towardsdatascience.com/tag/spark/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F&title=Orchestrating%20a%20Dynamic%20Time-series%20Pipeline%20in%20Azure)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F&title=Orchestrating%20a%20Dynamic%20Time-series%20Pipeline%20in%20Azure)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F&text=Orchestrating%20a%20Dynamic%20Time-series%20Pipeline%20in%20Azure)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](../images/015.jpg)](https://towardsdatascience.com/the-complete-guide-to-ai-implementation-for-chief-data-ai-officers-in-2026/)\n## [The Complete Guide to AI Implementation for Chief Data & AI Officers in 2026](https://towardsdatascience.com/the-complete-guide-to-ai-implementation-for-chief-data-ai-officers-in-2026/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nHow to leverage a framework to effectively prioritize AI Initiatives to rapidly accelerate growth and efficiency\n[Hugo Lu](https://towardsdatascience.com/author/hugolu87/)\nMarch 24, 202625 min read\n  * [![](../images/016.png)](https://towardsdatascience.com/a-simple-dag-using-airflow-2-0-b4c218b2ccd9/)\n## [A simple DAG using Airflow 2.0](https://towardsdatascience.com/a-simple-dag-using-airflow-2-0-b4c218b2ccd9/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nWe are using the newest Taskflow API from Airflow 2.0 to simplify DAG's syntax substantially.\n[Pedro Madruga](https://towardsdatascience.com/author/pmadruga/)\nAugust 8, 20213 min read\n  * [![](../images/017.jpeg)](https://towardsdatascience.com/develop-your-data-as-a-product-f9ba268c4e20/)\n## [Develop your Data as a Product](https://towardsdatascience.com/develop-your-data-as-a-product-f9ba268c4e20/)\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\nDrafting data engineering practices\n[Micha Kunze](https://towardsdatascience.com/author/mbakunze/)\nOctober 31, 20208 min read\n  * [![](../images/018.jpg)](https://towardsdatascience.com/faster-is-not-always-better-choosing-the-right-postgresql-insert-strategy-in-python-benchmarks/)\n## [Faster Is Not Always Better: Choosing the Right PostgreSQL Insert Strategy in Python (+Benchmarks)](https://towardsdatascience.com/faster-is-not-always-better-choosing-the-right-postgresql-insert-strategy-in-python-benchmarks/)\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\nThis article compares and benchmarks various insert strategies, focusing on trade-offs between safety, abstraction, and throughput — and choosing the right tool for the job.\n[Mike Huls](https://towardsdatascience.com/author/mikehuls/)\nJanuary 8, 20265 min read\n  * [![](../images/019.jpg)](https://towardsdatascience.com/3-steps-to-build-and-deploy-your-nlp-model-as-a-microservice-on-azure-426ca77c66df/)\n## [3 Steps to Build and Deploy your NLP model as a Microservice on Azure](https://towardsdatascience.com/3-steps-to-build-and-deploy-your-nlp-model-as-a-microservice-on-azure-426ca77c66df/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nThe easiest and cheapest way to deploy ML models on Azure\n[Ricardo Carvalho](https://towardsdatascience.com/author/ricardocarvalhods/)\nDecember 29, 20215 min read\n  * [![](../images/020.jpeg)](https://towardsdatascience.com/datetime-format-pandas-541c661d41c2/)\n## [How to Change the Datetime Format in Pandas](https://towardsdatascience.com/datetime-format-pandas-541c661d41c2/)\n[Programming](https://towardsdatascience.com/category/programming/)\nWorking with datetimes in Python and pandas\n[Giorgos Myrianthous](https://towardsdatascience.com/author/gmyrianthous/)\nJanuary 6, 20234 min read\n  * [![](../images/021.png)](https://towardsdatascience.com/getting-started-with-dbt/)\n## [Getting started with dbt](https://towardsdatascience.com/getting-started-with-dbt/)\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\nA practical guide to building, testing, and documenting SQL transformations\n[Thomas Reid](https://towardsdatascience.com/author/thomas_reid/)\nSeptember 9, 202622 min read\n  * [![](../images/022.jpg)](https://towardsdatascience.com/how-to-fix-cassandra-consistency-issues-using-read-repair-6dd45911819d/)\n## [How to Fix Cassandra Consistency Issues using Read Repair](https://towardsdatascience.com/how-to-fix-cassandra-consistency-issues-using-read-repair-6dd45911819d/)\n[](https://towardsdatascience.com/orchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231/)\nConsistency Issues or C in CAP theorem\n[Andriy Zabavskyy](https://towardsdatascience.com/author/andriy-zabavskyy/)\nSeptember 19, 20203 min read\n  * [![](../images/023.jpg)](https://towardsdatascience.com/custom-kafka-streaming-metrics-using-apache-spark-prometheus-sink-9c04cf2ddaf1/)\n## [Custom Kafka Streaming metrics using Apache Spark Prometheus Sink](https://towardsdatascience.com/custom-kafka-streaming-metrics-using-apache-spark-prometheus-sink-9c04cf2ddaf1/)\n[Programming](https://towardsdatascience.com/category/programming/)\nA detailed tutorial on how to create and expose custom Kafka Consumer metrics in Apache Spark's PrometheusServlet\n[Vitor Teixeira](https://towardsdatascience.com/author/vitorf24/)\nFebruary 2, 20236 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "metadata": {
    "title": "Orchestrating a Dynamic Time-series Pipeline in Azure | Towards Data Science",
    "description": "Explore how to build, trigger, and parameterize a time-series data pipeline with ADF and Databricks, accompanied by a step-by-step tutorial",
    "keywords": null,
    "author": "John Leung",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "Orchestrating a Dynamic Time-series Pipeline in Azure",
    "og:description": "Explore how to build, trigger, and parameterize a time-series data pipeline with ADF and Databricks, accompanied by a step-by-step tutorial",
    "og:url": "https://towardsdatascience.com/orchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/0OvcxSmhvVQ_nMXbL-scaled.jpg",
    "og:image:width": "2560",
    "og:image:height": "2044",
    "og:image:type": "image/jpeg",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "John Leung",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "8 min read",
    "article:published_time": "2024-05-31T05:09:05.000Z",
    "article:modified_time": "2024-05-31T05:09:05.000Z",
    "article:author": "https://towardsdatascience.com/author/johnleungtj/"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 202,
    "error": ""
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/f6ec4f5e2450/code/block_000.txt",
      "chars": 623
    },
    {
      "language": "txt",
      "file": "attachments/f6ec4f5e2450/code/block_001.txt",
      "chars": 212
    },
    {
      "language": "txt",
      "file": "attachments/f6ec4f5e2450/code/block_002.txt",
      "chars": 3062
    },
    {
      "language": "txt",
      "file": "attachments/f6ec4f5e2450/code/block_003.txt",
      "chars": 261
    }
  ],
  "images": [
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:00:38Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:00:38Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:00:38Z"
    },
    {
      "status": "http_404",
      "url": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "src": "https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500",
      "alt": "",
      "downloaded": false,
      "discovery": "saved_markdown",
      "retried_at": "2026-10-20T18:00:38Z"
    }
  ],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/c/TowardsDataScience",
      "kind": "channel_reference",
      "status": "reference_only"
    }
  ],
  "links": [
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/latest/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/editors-pick/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/the-variable/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/shipai/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/submissions/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/data-science/data-engineering/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/johnleungtj/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/performing-customer-analytics-with-langchain-and-llms-0af4ea38f7b5"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/managing-the-technical-debts-of-machine-learning-systems-5b85d420ab9d"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/azure/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/big-data/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/data-engineering/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/databricks/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/tag/spark/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/the-complete-guide-to-ai-implementation-for-chief-data-ai-officers-in-2026/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/category/artificial-intelligence/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/author/hugolu87/"
    },
    {
      "type": "internal",
      "href": "https://towardsdatascience.com/a-simple-dag-using-airflow-2-0-b4c218b2ccd9/"
    },
    {
      "type": "external",
      "href": "https://write.insightmediagroup.io"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/company/towards-data-science/"
    },
    {
      "type": "external",
      "href": "https://x.com/TDataScience"
    },
    {
      "type": "external",
      "href": "https://medium.com/towards-data-science/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287"
    },
    {
      "type": "external",
      "href": "https://unsplash.com/@juliorionaldo"
    },
    {
      "type": "external",
      "href": "https://unsplash.com"
    },
    {
      "type": "external",
      "href": "https://azure.microsoft.com/en-gb/products/databricks/"
    },
    {
      "type": "external",
      "href": "https://azure.microsoft.com/en-us/products/data-factory"
    },
    {
      "type": "external",
      "href": "https://docs.databricks.com/en/workflows/index.html"
    },
    {
      "type": "external",
      "href": "https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction"
    },
    {
      "type": "external",
      "href": "https://azure.microsoft.com/en-us/pricing/details/databricks/"
    },
    {
      "type": "external",
      "href": "https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/"
    },
    {
      "type": "external",
      "href": "https://www.kaggle.com/datasets/uciml/electric-power-consumption-data-set/data"
    },
    {
      "type": "external",
      "href": "https://opendatacommons.org/licenses/dbcl/1-0/"
    },
    {
      "type": "external",
      "href": "https://learn.microsoft.com/en-us/azure/data-factory/how-to-create-event-trigger?tabs=data-factory"
    },
    {
      "type": "external",
      "href": "https://medium.com/@johnleungTJ/how-to-design-the-ai-architectures-in-azure-for-the-new-era-9531229cfd33"
    },
    {
      "type": "external",
      "href": "https://medium.com/@johnleungTJ"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/in/john-leung-639800115/"
    },
    {
      "type": "external",
      "href": "https://www.facebook.com/sharer/sharer.php?title=Orchestrating+a+Dynamic+Time-series+Pipeline+in+Azure&u=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F"
    },
    {
      "type": "external",
      "href": "https://www.linkedin.com/shareArticle?mini=true&title=Orchestrating+a+Dynamic+Time-series+Pipeline+in+Azure&url=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-20T17:30:14Z",
  "source_url": "https://towardsdatascience.com/orchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231/",
  "delivery_status": "unverified",
  "discovery_status": "http_403",
  "missing_reason": "源页面未重新核验:http_403；已按保留正文补采图片",
  "repair_error": "",
  "actual_video_files": [],
  "expected_saved_body_images": 4,
  "image_discovery": "saved_markdown",
  "source_body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\n# Orchestrating a Dynamic Time-series Pipeline in Azure\nExplore how to build, trigger, and parameterize a time-series data pipeline with ADF and Databricks, accompanied by a step-by-step tutorial\n[John Leung](https://towardsdatascience.com/author/johnleungtj/)\nMay 31, 20248 min read\n# Orchestrating a Dynamic Time-Series Pipeline in Azure\n### Explore how to build, trigger, and parameterize a time-series data pipeline with Azure Data Factory (ADF) and Databricks, accompanied by a step-by-step tutorial\nIn the [previous story](https://medium.com/towards-data-science/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287), we went through the potential of PySpark on Databricks for time-series data. I encourage you to catch up [here](https://medium.com/towards-data-science/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287) to know more. Without configuring a standalone Spark instance, we can ingest static and streaming data, perform transformation, extract useful time-related features, and build visualization using PySpark on Databricks. Its scalability and performance are particularly advantageous when handling complex transformations of enterprise-level data, up to petabytes.\nAll the feature engineering tasks were successfully performed within a single Databricks notebook. However, this is only a part of the data engineering story when building a data-centric system. The core part of the data pipeline lies in data orchestration.\n> Data orchestration generally refers to have the centralized control over data flows so that we can automate, manage, and monitor the entire data pipeline.\n![Photo by Julio Rionaldo on Unsplash](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/0OvcxSmhvVQ_nMXbL-scaled.jpg)\nPhoto by [Julio Rionaldo](https://unsplash.com/@juliorionaldo?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)\n* * *\n### Azure Data Factory (ADF) with Azure Databricks\nTo satisfy these needs, one of the most popular solutions in the industry is to run [Azure Databricks](https://azure.microsoft.com/en-gb/products/databricks/#content-card-list-oc803c) notebooks from an [ADF](https://azure.microsoft.com/en-us/products/data-factory#features) platform.\nADF is a cloud-based, serverless, and fully managed data integration service. Though [Databricks Workflow](https://docs.databricks.com/en/workflows/index.html) gives a good alternative that covers some ADF features, there are still several key benefits to choosing ADF. For example, ADF is a mature tool for integrating with diverse data stores using connectors, including SaaS applications like Salesforce, and Big Data sources like Amazon Redshift, and Google BigQuery. Therefore, it works well for ingestion and integration, especially if the current system has complex dependencies with data systems outside of Databricks. Besides, ADF simplifies and facilitates the quick building of basic pipelines using a drag-and-drop and low-code interface.\n* * *\n**In this hands-on journey, we will dive deeper into the data engineering project and explore how ADF helps build a dynamic, skeletal data pipeline for time-series data.** I will demonstrate how to mount cloud storage on Azure Databricks, transform data by embedding Notebook on Azure Databricks, and dynamically orchestrate data through custom settings in ADF. Let's get started!\n### The initial setup\nThere are several cloud components and services in the first place.\n**#1 Create an Azure resource group**\nThis container is used to hold and group the resources for an Azure solution. We will place our necessary cloud service components in this logical group for easier building or deployment.\n![Azure resource group \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1kC5g-rTZ0YoVb1HLktC82Q.png)\nAzure resource group (Image by author)\n**#2 Create an Azure Data Lake Gen 2 storage account**\nYou can choose a suitable storage account based on the requirements of performance and replication. In the advanced tab, we enable the Hierarchical Namespace to set up the [Data Lake Storage Gen 2](https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-introduction). This allows for storing both structured and unstructured data.\n![Storage account \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1ZcmManvddwjZK4wpdkRuEw.png)\nStorage account (Image by author)\n**#3 Set up Azure Databricks service**\nIf you have used Databricks before, Azure Databricks service is largely the same. Besides, it is natively integrated with other Azure services and provides a unified billing platform. There are two [tiers](https://azure.microsoft.com/en-us/pricing/details/databricks/): (1) Standard - sufficient for our proof-of-concept here; and (2) Premium - the features of the Standard tier, with additionally the [Unity Catalog](https://learn.microsoft.com/en-us/azure/databricks/data-governance/unity-catalog/) and the advanced networking features that may be necessary for a large enterprise with multiple Databricks workspaces.\n![Azure Databricks workspace \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/10U84-I5MFZyUEFR8x9guiQ.png)\nAzure Databricks workspace (Image by author)\n**#4 Register an application**\nThis service will help mount Azure storage to Databricks, so make sure you note the application ID and tenant ID, and most importantly the app secret value, which cannot be viewed when you revisit it.\n![App registration - Setting \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1gNPwIc3rQgrrNHETI39LCw.png)\nApp registration - Setting (Image by author)\n![App registration - Info \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1LpiOURCPhVgqNheQCrtEHg.png)\nApp registration - Info (Image by author)\n![App registration - Client secret \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/19YNk0Lynvz242-qndWEOLA.png)\nApp registration - Client secret (Image by author)\nAfterward, grant the app service access rights to the app service. This is achieved by assigning the \"Storage Blob Data Contributor\" role to the app we just registered.\n![Storage account - Grant access right \\(1/3\\) \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1wSOMnCPth_lHcmUUZcQ07w.png)\nStorage account - Grant access right (1/3) (Image by author)\n![Storage account - Grant access right \\(2/3\\) \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1uCl1BbAp8Xt4YiyXpVOCWw.png)\nStorage account - Grant access right (2/3) (Image by author)\n![Storage account - Grant access right \\(3/3\\) \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1sUuG9YUa8RamUZBTjUejWg.png)\nStorage account - Grant access right (3/3) (Image by author)\n**#5 Create Azure SQL Database**\nTo store a transformed data frame, we search for Azure SQL resources and pick a \"Single database\" as the resource type. There are choices of SQL database servers with different computing hardware, maximum data size, and more. You can instantly get the estimated cost summary while adjusting the server specifications.\n![Create SQL Database \\(1/2\\) \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1O8xt0k0w7fKgYZF7sqIiEg.png)\nCreate SQL Database (1/2) (Image by author)\n![Create SQL Database \\(2/2\\) \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1rLbZ4isotj43dBRLxJUuDA.png)\nCreate SQL Database (2/2) (Image by author)\nAfter all the initial setups, you are ready to explore how these services are linked together.\n### Prepare for data orchestrating pipeline\n**#1 Ingest data**\nWe first upload the electric power consumption data to Azure Data Lake Gen2. This [dataset](https://www.kaggle.com/datasets/uciml/electric-power-consumption-data-set/data) [with license as [Database: Open Database, Contents: Database Contents](https://opendatacommons.org/licenses/dbcl/1-0/)], obtained from Kaggle, is sampled at a one-minute rate from December 2006 to November 2010.\n![Upload input data \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1hrQJhabM2fvIaduNLMsdDA.png)\nUpload input data (Image by author)\nNext, we create a Notebook on the Azure Databricks workspace and mount storage by defining the parameters using previously stored ID values.\npython\n\n```\n# Define the configuration specifications\nconfigs = {\"fs.azure.account.auth.type\": \"OAuth\",\n\"fs.azure.account.oauth.provider.type\": \"org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider\",\n\"fs.azure.account.oauth2.client.id\": \"<Client ID>\",\n\"fs.azure.account.oauth2.client.secret\": \"<Client Secret>\",\n\"fs.azure.account.oauth2.client.endpoint\": \"https://login.microsoftonline.com/<Tenant ID>/oauth2/token\"\n}\n\ndbutils.fs.mount(\n  source = \"abfss://input@adlstsdp.dfs.core.windows.net/\", # URI of the object storage\n  mount_point = \"/mnt/adlstsdp/input\",  # local path in the /mnt directory\n  extra_configs = configs)\n```\n\nTo verify file access, we can run the following command:\npython\n\n```\ndbutils.fs.ls(\"/mnt/adlstsdp/input\")\n\n# Output: [FileInfo(path='dbfs:/mnt/adlstsdp/input/household_power_consumption.csv', name='household_power_consumption.csv', size=132960755, modificationTime=1716798010000)]\n```\n\n**#2 Embed Notebook on Azure Databricks**\nMost of the source codes in this section build upon my [previous story](https://towardsdatascience.com/feature-engineering-for-time-series-using-pyspark-on-databricks-02b97d62a287). The idea is to perform data cleansing, transformation, and feature engineering (create time-related and moving averaging features). The transformed data is ultimately written to the Azure database table.\nYou can check the complete code below to see the implementation.\npython\n\n```\n# Define file location, file typem and CSV options\nfile_location = \"/mnt/adlstsdp/input/household_power_consumption.csv\"\nfile_type = \"csv\"\nschema = \"Date STRING, Time STRING, Global_active_power DOUBLE, Global_reactive_power DOUBLE, Voltage DOUBLE, Global_intensity DOUBLE, Sub_metering_1 DOUBLE, Sub_metering_2 DOUBLE, Sub_metering_3 DOUBLE\"\nfirst_row_is_header = \"true\"\ndelimiter = \";\"\n\n# Read CSV files\norg_df = spark.read.format(file_type) \n  .schema(schema) \n  .option(\"header\", first_row_is_header) \n  .option(\"delimiter\", delimiter) \n  .load(file_location)\n\n# Data cleansing and transformation\nfrom pyspark.sql.functions import *\ncleaned_df = org_df.na.drop()\ncleaned_df = cleaned_df.withColumn(\"Date\", to_date(col(\"Date\"),\"d/M/y\"))\ncleaned_df = cleaned_df.withColumn(\"Date\", cleaned_df[\"Date\"].cast(\"date\"))\ncleaned_df = cleaned_df.select(concat_ws(\" \", to_date(col(\"Date\"),\"d/M/y\"), col(\"Time\")).alias(\"DateTime\"), \"*\")\ncleaned_df = cleaned_df.withColumn(\"DateTime\", cleaned_df[\"DateTime\"].cast(\"timestamp\"))\ndf = cleaned_df.groupby(\"Date\").agg(\n    round(sum(\"Global_active_power\"), 2).alias(\"Total_global_active_power\"),\n    ).sort([\"Date\"])\n\n# Add time-related features\ndf = df.withColumn(\"year\", year(\"Date\"))\ndf = df.withColumn(\"month\", month(\"Date\"))\ndf = df.withColumn(\"week_num\", weekofyear(\"Date\"))\n\n# Add lagged value features of total global active power\nfrom pyspark.sql.window import Window\nfrom pyspark.sql.functions import lag\n\nwindowSpec = Window.orderBy(\"Date\")\ndf = df.withColumn(\"power_lag1\", round(lag(col(\"Total_global_active_power\"), 1).over(windowSpec), 2))\n\n# Create delta field\ndf = df.withColumn(\"power_lag1_delta\", round(col(\"power_lag1\") - col(\"Total_global_active_power\"), 2))\n\n# Create window average fields\ndef add_window_avg_fields(df, window_sizes):\n    for idx, window_size in enumerate(window_sizes, start=1):\n        window_col_name = f\"avg_power_lag_{idx}\"\n        windowSpec = Window.orderBy(\"Date\").rowsBetween(-window_size, 0)\n        df = df.withColumn(window_col_name, round(avg(col(\"Total_global_active_power\")).over(windowSpec), 2))\n    return df\n\nwindow_sizes = [14, 30]\ndf = add_window_avg_fields(df, window_sizes)\n\n# Create Exponentially Weighted Moving Average (EWMA) fields\nimport pyspark.pandas as ps\nps.set_option('compute.ops_on_diff_frames', True)\n\ndef add_ewma_fields(df, alphas):\n    for idx, alpha in enumerate(alphas, start=1):\n        ewma_col_name = f\"ewma_power_weight_{idx}\"\n        windowSpec = Window.orderBy(\"Date\")\n        df[ewma_col_name] = df.Total_global_active_power.ewm(alpha=alpha).mean().round(2)\n    return df\n\nalphas = [0.2, 0.8]\ndf_pd = df.pandas_api()\ndf_pd = add_ewma_fields(df_pd, alphas)\ndf = df_pd.to_spark()\n\n# Write transformed dataframe to the database table \"electric_usage_table\"\ndf.write.format(\"jdbc\") \n    .option(\"url\", \"jdbc:sqlserver://sql-db-dp.database.windows.net:1433;databaseName=sql-db-dp\") \n    .option(\"dbtable\", \"dbo.electric_usage_table\") \n    .option(\"user\", \"<username>\") \n    .option(\"password\", \"<password>\") \n    .mode(\"overwrite\")  \n    .save()\n```\n\n**#3 Build a basic pipeline in ADF**\nIn ADF, we add a \"Notebook\" activity to the pipeline environment, then configure it to reference the desired Notebook in the Databricks folder. Set up the Databricks linked service, then validate and publish the entire activity pipeline in ADF. You can then run the pipeline in \"Debug\" mode.\n![The success status of pipeline run \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1fW2eixfAUhQSHmJ6uADb6g.png)\nThe success status of pipeline run (Image by author)\nThe activity status shows \"Succeeded\", meaning the data should be migrated and inserted into the Azure SQL Database table. We can view the results for verification using the query editor.\n![Query result of the Azure SQL database \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1zDK-hqyRSSGXpjhZv-78mA.png)\nQuery result of the Azure SQL database (Image by author)\n**#4 Automate the pipeline**\nADF offers functionalities that are far beyond the above simple implementation. For example, we can automate the pipeline by creating a [storage-based event trigger](https://learn.microsoft.com/en-us/azure/data-factory/how-to-create-event-trigger?tabs=data-factory). Make sure that `Microsoft.EventGrid` is registered as one of the resource providers in your account subscription, then set up the trigger: Whenever a new dataset is uploaded to the storage account, the pipeline will automatically execute.\n![Set a new trigger in ADF \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1xb0QcReEjsblZj5MIS_0Zw.png)\nSet a new trigger in ADF (Image by author)\nThis type of trigger has various use cases in the industries, such as monitoring the inventory level to replenish orders for the supply chain or tracking customer interactions for personalized recommendations in digital marketing.\n**#5 Parameterize the Notebook variables**\nTo take a further step to build a more dynamic data pipeline, we can make variables more parametric. For example, during feature engineering on time-series data, the window size of data features may not be optimized initially. The window sizes may need to be adjusted to capture seasonal patterns or based on downstream model fine-tuning. For this scenario, we can amend with the below settings.\n![Set up parameters for pipeline run \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1tl3-iR-AnLUdMPi8YCJGdA.png)\nSet up parameters for pipeline run (Image by author)\nIn the Notebook, add the code below to create a widget that can get the parameters input from the ADF pipeline:\npython\n\n```\n# Additional code: Access the current value of the widget\ninputWindowSizes = dbutils.widgets.get(\"inputWindowSizes\")\nwindow_sizes = inputWindowSizes.split(\",\")\n\n# Original function for adding window average features\ndf = add_window_avg_fields(df, window_sizes)\n```\n\nAfter adjusting the settings and the Notebook codes, we can run the pipeline by providing the window size parameter values, such as 30 and 60.\n![Input window size value for pipeline run \\(Image by author\\)](https://assets.insightmediagroup.io/media/wp-content/uploads/2024/05/1EUlysyx8zM6T8o9ez_fZGA.png)\nInput window size value for pipeline run (Image by author)\nFinally, we can monitor the pipeline status again using ADF or Databricks workspace.\n### Wrapping it up\nIn our hands-on exploration, we mainly used ADF with Azure Databricks to orchestrate a dynamic time-series data pipeline:\n  * Setup the cloud resources for the compute, analytics, and storage\n  * Build the skeleton of the data pipeline from data ingestion to storage\n  * Bring flexibilities to the pipeline by creating triggers and parameterizing variables\n\n\nAt the enterprise level, more [complex cloud architectures](https://medium.com/@johnleungTJ/how-to-design-the-ai-architectures-in-azure-for-the-new-era-9531229cfd33) may be implemented to satisfy evolving needs, such as streaming data, model monitoring, and multi-model pipelines. It thus becomes essential to strive for a delicate balance between performance, reliability, and cost-efficiency through team collaboration on governance policies and spending management.\n* * *\n### Before you go\nIf you enjoy this reading, I invite you to **** follow my [Medium page](https://medium.com/@johnleungTJ) and [LinkedIn page](https://www.linkedin.com/in/john-leung-639800115/). By doing so, you can stay updated with exciting content related to data science side projects and Machine Learning Operations (MLOps) demonstration methodologies.\n> [**Performing Customer Analytics with LangChain and LLMs**](https://towardsdatascience.com/performing-customer-analytics-with-langchain-and-llms-0af4ea38f7b5)\n> [**Managing the Technical Debts of Machine Learning Systems**](https://towardsdatascience.com/managing-the-technical-debts-of-machine-learning-systems-5b85d420ab9d)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657188043_vu8s9b.jpeg)\nWritten By\n## [John Leung](https://towardsdatascience.com/author/johnleungtj/)\n[See all from John Leung](https://towardsdatascience.com/author/johnleungtj/)\n[Azure](https://towardsdatascience.com/tag/azure/)[Big Data](https://towardsdatascience.com/tag/big-data/)[Data Engineering](https://towardsdatascience.com/tag/data-engineering/)[Databricks](https://towardsdatascience.com/tag/databricks/)[Spark](https://towardsdatascience.com/tag/spark/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F&title=Orchestrating%20a%20Dynamic%20Time-series%20Pipeline%20in%20Azure)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F&title=Orchestrating%20a%20Dynamic%20Time-series%20Pipeline%20in%20Azure)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Forchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231%2F&text=Orchestrating%20a%20Dynamic%20Time-series%20Pipeline%20in%20Azure)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/03/CDO_DIGEST-1.jpg)](https://towardsdatascience.com/the-complete-guide-to-ai-implementation-for-chief-data-ai-officers-in-2026/)\n## [The Complete Guide to AI Implementation for Chief Data & AI Officers in 2026](https://towardsdatascience.com/the-complete-guide-to-ai-implementation-for-chief-data-ai-officers-in-2026/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nHow to leverage a framework to effectively prioritize AI Initiatives to rapidly accelerate growth and efficiency\n[Hugo Lu](https://towardsdatascience.com/author/hugolu87/)\nMarch 24, 202625 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/08/0zvKadaSfnZ0Md2OF.png)](https://towardsdatascience.com/a-simple-dag-using-airflow-2-0-b4c218b2ccd9/)\n## [A simple DAG using Airflow 2.0](https://towardsdatascience.com/a-simple-dag-using-airflow-2-0-b4c218b2ccd9/)\n[Data Science](https://towardsdatascience.com/category/data-science/)\nWe are using the newest Taskflow API from Airflow 2.0 to simplify DAG's syntax substantially.\n[Pedro Madruga](https://towardsdatascience.com/author/pmadruga/)\nAugust 8, 20213 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/1JGkKB8jtYNvTq8_2FPaMmQ.jpeg)](https://towardsdatascience.com/develop-your-data-as-a-product-f9ba268c4e20/)\n## [Develop your Data as a Product](https://towardsdatascience.com/develop-your-data-as-a-product-f9ba268c4e20/)\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\nDrafting data engineering practices\n[Micha Kunze](https://towardsdatascience.com/author/mbakunze/)\nOctober 31, 20208 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/01/postgresinsert.jpg)](https://towardsdatascience.com/faster-is-not-always-better-choosing-the-right-postgresql-insert-strategy-in-python-benchmarks/)\n## [Faster Is Not Always Better: Choosing the Right PostgreSQL Insert Strategy in Python (+Benchmarks)](https://towardsdatascience.com/faster-is-not-always-better-choosing-the-right-postgresql-insert-strategy-in-python-benchmarks/)\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\nThis article compares and benchmarks various insert strategies, focusing on trade-offs between safety, abstraction, and throughput — and choosing the right tool for the job.\n[Mike Huls](https://towardsdatascience.com/author/mikehuls/)\nJanuary 8, 20265 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/12/0MoeMmaBg0itaLTcI-scaled.jpg)](https://towardsdatascience.com/3-steps-to-build-and-deploy-your-nlp-model-as-a-microservice-on-azure-426ca77c66df/)\n## [3 Steps to Build and Deploy your NLP model as a Microservice on Azure](https://towardsdatascience.com/3-steps-to-build-and-deploy-your-nlp-model-as-a-microservice-on-azure-426ca77c66df/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nThe easiest and cheapest way to deploy ML models on Azure\n[Ricardo Carvalho](https://towardsdatascience.com/author/ricardocarvalhods/)\nDecember 29, 20215 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/01/1EgRfXO_zyGr9nE1XvXOa1w-scaled.jpeg)](https://towardsdatascience.com/datetime-format-pandas-541c661d41c2/)\n## [How to Change the Datetime Format in Pandas](https://towardsdatascience.com/datetime-format-pandas-541c661d41c2/)\n[Programming](https://towardsdatascience.com/category/programming/)\nWorking with datetimes in Python and pandas\n[Giorgos Myrianthous](https://towardsdatascience.com/author/gmyrianthous/)\nJanuary 6, 20234 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2026/08/Codex-Image-4-Aug-2026-18_13_53.png)](https://towardsdatascience.com/getting-started-with-dbt/)\n## [Getting started with dbt](https://towardsdatascience.com/getting-started-with-dbt/)\n[Data Engineering](https://towardsdatascience.com/category/data-science/data-engineering/)\nA practical guide to building, testing, and documenting SQL transformations\n[Thomas Reid](https://towardsdatascience.com/author/thomas_reid/)\nSeptember 9, 202622 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/09/0RlGB6bwCsZBXS-Ym-scaled.jpg)](https://towardsdatascience.com/how-to-fix-cassandra-consistency-issues-using-read-repair-6dd45911819d/)\n## [How to Fix Cassandra Consistency Issues using Read Repair](https://towardsdatascience.com/how-to-fix-cassandra-consistency-issues-using-read-repair-6dd45911819d/)\n[](https://towardsdatascience.com/orchestrating-a-dynamic-time-series-pipeline-with-azure-data-factory-and-databricks-810819608231/)\nConsistency Issues or C in CAP theorem\n[Andriy Zabavskyy](https://towardsdatascience.com/author/andriy-zabavskyy/)\nSeptember 19, 20203 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/02/0zdBfXVzdaPjHwxqV-scaled.jpg)](https://towardsdatascience.com/custom-kafka-streaming-metrics-using-apache-spark-prometheus-sink-9c04cf2ddaf1/)\n## [Custom Kafka Streaming metrics using Apache Spark Prometheus Sink](https://towardsdatascience.com/custom-kafka-streaming-metrics-using-apache-spark-prometheus-sink-9c04cf2ddaf1/)\n[Programming](https://towardsdatascience.com/category/programming/)\nA detailed tutorial on how to create and expose custom Kafka Consumer metrics in Apache Spark's PrometheusServlet\n[Vitor Teixeira](https://towardsdatascience.com/author/vitorf24/)\nFebruary 2, 20236 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607686/image?etag=1782161464448&width=500&height=500) How Relevance Models Foreshadowed Transformers for NLP ](https://towardsdatascience.com/how-relevance-models-foreshadowed-transformers-for-nlp/ \"How Relevance Models Foreshadowed Transformers for NLP\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607639/image?etag=1781250125848&width=500&height=500) Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1 ](https://towardsdatascience.com/javascript-fatigue-you-dont-need-js-to-build-chatgpt/ \"Javascript Fatigue: HTMX Is All You Need to Build ChatGPT — Part 1\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n\n\n",
  "body_base_path": "attachments/f6ec4f5e2450/pages/",
  "body_markdown_path": "attachments/f6ec4f5e2450/pages/archived-body.md",
  "local_html": "attachments/f6ec4f5e2450/pages/archived-body.html",
  "body_source": "prior_capture"
}