保留正文与补采附件。源页面当前未重新核验;具体限制见交付清单。
We value your privacy
We 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.
Customise Reject All Accept All
Customise Consent Preferences
We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.
The 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
NecessaryAlways Active
Necessary 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.
Cookie BCTempID
Duration 10 minutes
Description No description available.
Cookie __cf_bm
Duration 1 hour
Description This cookie, set by Cloudflare, is used to support Cloudflare Bot Management.
Cookie AWSALBCORS
Duration 7 days
Description Amazon Web Services set this cookie for load balancing.
Cookie _cfuvid
Duration session
Description Cloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services
Cookie li_gc
Duration 6 months
Description Linkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.
Cookie __hssrc
Duration session
Description This 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.
Cookie __hssc
Duration 1 hour
Description HubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.
Cookie wpEmojiSettingsSupports
Duration session
Description WordPress 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.
Cookie BCSessionID
Duration 1 year 1 month 4 days
Description Blueconic sets this cookie as a unique identifier for the BlueConic profile.
Cookie _octo
Duration 1 year
Description No description available.
Cookie logged_in
Duration 1 year
Description No description available.
Cookie __Secure-YEC
Duration past
Description YouTube sets this cookie to stores the user's video player preferences using embedded YouTube video
Cookie __eoi
Duration 6 months
Description Description is currently not available.
Cookie AWSALBTGCORS
Duration 7 days
Description No description available.
Cookie login-status-p
Duration past
Description Description is currently not available.
Cookie AWSALBTG
Duration 7 days
Description No description available.
Cookie csrf_token
Duration session
Description No description available.
Cookie token_v2
Duration 1 day
Description Description is currently not available.
Cookie D
Duration 1 year
Description Description is currently not available.
Cookie PHPSESSID
Duration session
Description This 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.
Cookie VISITOR_PRIVACY_METADATA
Duration 6 months
Description YouTube sets this cookie to store the user's cookie consent state for the current domain.
Cookie cookietest
Duration session
Description The cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.
Cookie __Host-airtable-session
Duration 1 year
Description This cookie is used to enable us to integrate the services of Airtable.
Cookie __Host-airtable-session.sig
Duration 1 year
Description This cookie is used to enable us to integrate the services of Airtable.
Cookie m
Duration 1 year 1 month 4 days
Description Stripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.
Cookie BIGipServer*
Duration session
Description Marketo 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.
Cookie __cfruid
Duration session
Description Cloudflare sets this cookie to identify trusted web traffic.
Cookie _GRECAPTCHA
Duration 6 months
Description Google Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.
Cookie __Secure-YNID
Duration 6 months
Description Google cookie used to protect user security and prevent fraud, especially during the login process.
Cookie cookieyes-consent
Duration 1 year
Description CookieYes 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.
Functional Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.
Cookie lidc
Duration 1 day
Description LinkedIn sets the lidc cookie to facilitate data center selection.
Cookie brw
Duration 1 year
Description No description available.
Cookie brwConsent
Duration 5 minutes
Description Description is currently not available.
Cookie WMF-Uniq
Duration 1 year
Description Description is currently not available.
Cookie loom_anon_comment
Duration 1 year
Description No description available.
Cookie loom_referral_video
Duration session
Description Description is currently not available.
Cookie VISITOR_INFO1_LIVE
Duration 6 months
Description A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.
Cookie yt-remote-connected-devices
Duration Never Expires
Description YouTube sets this cookie to store the user's video preferences using embedded YouTube videos.
Cookie ytidb::LAST_RESULT_ENTRY_KEY
Duration Never Expires
Description The 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.
Cookie yt-remote-device-id
Duration Never Expires
Description YouTube sets this cookie to store the user's video preferences using embedded YouTube videos.
Cookie yt-remote-session-name
Duration session
Description The yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.
Cookie yt-remote-fast-check-period
Duration session
Description The yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.
Cookie yt-remote-session-app
Duration session
Description The yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.
Cookie yt-remote-cast-available
Duration session
Description The yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.
Cookie yt-remote-cast-installed
Duration session
Description The yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.
Cookie cp_session
Duration 3 months
Description Codepen sets this cookie for Help systems found in the website.
Cookie loid
Duration 1 year 1 month 4 days
Description This cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.
Analytics Analytical 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.
Cookie __hstc
Duration 6 months
Description Hubspot 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).
Cookie hubspotutk
Duration 6 months
Description HubSpot 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.
Cookie _ga
Duration 1 year 1 month 4 days
Description Google 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.
Cookie ga*
Duration 1 year 1 month 4 days
Description Google Analytics sets this cookie to store and count page views.
Cookie __Host-psifi.analyticsTrace
Duration 6 hours
Description Description is currently not available.
Cookie __Host-psifi.analyticsTraceV2
Duration 6 hours
Description Description is currently not available.
Cookie _gh_sess
Duration session
Description GitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.
Cookie YSC
Duration session
Description YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.
Cookie ajs_anonymous_id
Duration 1 year
Description This cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.
Cookie vuid
Duration 1 year 1 month 4 days
Description Vimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website.
Performance Performance 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.
Cookie AWSALB
Duration 7 days
Description AWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.
Cookie acq
Duration past
Description Description is currently not available.
Cookie acq.sig
Duration past
Description Description is currently not available.
Cookie ptc
Duration 2 years
Description No description available.
Advertisement Advertisement 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.
Cookie muc_ads
Duration 1 year 1 month 4 days
Description Twitter sets this cookie to collect user behaviour and interaction data to optimize the website.
Cookie guest_id_marketing
Duration 1 year 1 month 4 days
Description Twitter sets this cookie to identify and track the website visitor.
Cookie guest_id_ads
Duration 1 year 1 month 4 days
Description Twitter sets this cookie to identify and track the website visitor.
Cookie personalization_id
Duration 1 year 1 month 4 days
Description Twitter 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.
Cookie guest_id
Duration 1 year 1 month 4 days
Description Twitter 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.
Cookie bcookie
Duration 1 year
Description LinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.
Cookie __Secure-ROLLOUT_TOKEN
Duration 6 months
Description YouTube 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.
Cookie yt.innertube::nextId
Duration Never Expires
Description YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.
Cookie yt.innertube::requests
Duration Never Expires
Description YouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.
Cookie session_tracker
Duration session
Description This cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.
Cookie edgebucket
Duration session
Description Reddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.
Cookie did
Duration 1 year
Description Arbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.
Uncategorised Other uncategorised cookies are those that are being analysed and have not been classified into a category as yet. No cookies to display. Reject All Save My Preferences Accept All Toggle SearchToggle Mobile Navigation Publish AI, ML & data-science insights to a global community of data professionals. Sign inSubmit an Article LatestEditor's PicksNewsletterShipAI
Write For TDS LinkedInXToggle Search Data Science
A go-to guide for data engineers wading through the backfilling maze
Naser Tamimi
November 17, 20237 min read

Imagine starting a new data pipeline and getting data from a source you've never parsed before (e.g. pulling info from an API or an existing hive table). Now, you're on a mission to make it seem like you collected this data ages ago. That's one example of what we call data backfilling in data engineering. But it's not just about starting a new data pipeline or table. You could have a table that's been gathering data for a while, and suddenly, you need to change the data (for example due to a new metric definition), or toss in more data from a new data source. Or maybe there's an awkward gap in your data, and you just want to patch it up. All these situations are examples of data backfilling. The common thread is turning "back" in time and "filling" up your table with some historical data. The following figure (Figure 1) shows a straightforward backfilling scenario. In this instance, a daily job retrieves data from two upstream sources (one for platform A and another for platform B). The dataset is structured with the first partition being 'ds,' and the second partition (or sub-partitions) representing the platforms. Unfortunately, data for the period from 2023–10–03 to 2023–10–05 is absent due to certain issues. To address this gap, a backfilling operation was initiated (the backfilling job started on 2023–10–08). Learn this step by step with the interactive AI and Data Scientist, Computer Science and Data Engineer roadmaps.
A brief heads-up before proceeding further: within the domain of data engineering, we normally encounter two scenarios: "backfilling" a table or "restating" a table. These processes, while sharing some similarities, have some subtle differences. Backfilling, as a practice, is about populating missing or incomplete data in a dataset. Its application is commonly directed towards updating historical data or rectifying gaps. Conversely, restating a table involves effecting substantial alterations to the content or structure of the table. This transformation is typically undertaken to rectify errors, update data models, or implement significant modifications to the dataset. For the sake of simplicity, acknowledging the subtle differences of these terms, both processes will be referred to as "backfilling" in this article. It's worth mentioning that there could be variations in how different engineers refer to these processes.
Let's dive a bit deeper. You are designing your new table schema and planning out your ETL processes. Definitely give some serious thought to backfilling. So, take a moment to ask yourself: Is my design good to go for both the regular (mostly daily) tasks and handling future backfilling tasks? Can I easily fill in missing data when I need to, or is it going to be a headache with manual steps every time I want to patch things up? Sometimes you need to find a sweet spot in your design. You want things to run smoothly, not just for your everyday data flow but also when you're trying to fix up any gaps in your dataset. So, a little extra attention to your design now can save you from headaches later on! For example, you might think that if you do a backfill for this table, you need to overwrite the previous data and not append to it. In this case, if you are using Hive tables, maybe Hive partitions can help you achieve this goal more easily. In this case, you can define a partition based on the date (mostly called 'ds') and change your ETL to overwrite the partition instead of appending to it. With this schema design, every time you write on your table, the previous partitions (in this case, previous 'ds' dates) will be removed and replaced with new data. However, you might foresee that every backfill might only need to affect not the entire 'ds,' but part of that. For example, look at Figure 1 and ds=2023–10–05. In this case, part of the data is loaded successfully and part of that failed. In such cases, you can define a secondary partition (or even tertiary if needed) to support partial backfilling for a specific date in the future. At the same time, you want to keep your number of partitions as low as possible to avoid small partitions (which might cause less efficient data processing). Another effective strategy involves writing the newly backfilled data to a distinct partition location rather than overwriting the existing partition location on the disk. This can be achieved by, for instance, introducing a unique runtime_id directory within your partition location path. Subsequently, update the partition location in the Hive metastore from the old path to the new path. This approach enables the retention of previous data (as a precaution) while still facilitating the update of the entire partition. The following folder structure is an example of how we can runtime_id to keep different versions of backfilling under the same table location. Remember, this technique requires that your ETL update partition locations in the Hive metastore database. text
table_location_path
└── runtime_id_1651023692 (*new backfill)
├── ds=2021-01-01 (*active/newest partition)
├── data_file
├── ds=2021-01-02 (*active/newest partition)
└── data_file
└── ds=2021-01-03 (*active/newest partition)
└── data_file
└── runtime_id_1609562892 (*daily job run)
└── ds=2021-01-01 (*inactive/archived partition)
└── data_file
Also, in addition to your regular (for example, daily) workflow, you might need to develop a ready-to-go backfilling workflow for cases in which you need to backfill the data. For instance, if you are working on Apache Airflow, you can have a daily DAG for your regular scheduled data loading tasks and a separate DAG for backfilling. In this case, if something happens that requires backfilling data quickly, you have a DAG ready to go.
You carefully crafted your table schema and ETL pipelines, anticipating the need for future backfilling. Now, after days, weeks, or even months, the long-awaited moment for backfilling has arrived. But what steps should you take? Is it as straightforward as running your backfill workflow/DAG for a specified date range, or does it demand more careful consideration before hitting the backfill button? Unfortunately, the design isn't the sole challenge to overcome. The backfilling process itself can be quite intricate. Initially, you must ensure that backfilling is feasible. For instance, certain APIs may not support historical data beyond a specific lookback period, while some source tables might not retain data for an extended duration due to privacy constraints. It's essential to confirm whether backfilling for your specific timeframe is viable. Now, let's assume luck is on your side, and data availability poses no issues. The next consideration revolves around your table users. Adding or modifying data, especially historical data, can impact downstream users. A responsible data engineer takes into account the consequences of such actions on product users and demonstrates respect for their experience. In some scenarios, notifying downstream users in advance about the backfilling operation may be necessary for them to obtain the most up-to-date data. Additionally, you may need to assess how changes to a column affect other tables. In an open coding ecosystem, engineers can collaborate to check other projects and data pipelines for verification. If a downstream user relies on a column slated for modification, it's crucial to evaluate the impact and explore alternatives, such as expanding the table instead of altering column logic. Can you assist them in updating their ETL logic, or should you redirect them to an alternative data source? In essence, displaying responsibility for what you and your team own is what distinguishes a good engineer from a less effective one.
Now that your backfilling is complete, the next crucial step is validation. Employing some fundamental techniques can expedite the validation process.
first, it is crucial to verify the completion of the backfilling process. Occasionally, even when it appears that the backfilling job has been executed and completed successfully, an incorrect parameter may result in no actual updates or data being written to the table. Therefore, prior to validating the backfilled data, it is imperative to confirm the successful execution of the backfilling process. Introducing a specific column in the table that captures the processing timestamp can aid in validating whether the data has been recently updated. Alternatively, checking the runtime_id associated with new partition locations is another method. As outlined in the design section, the inclusion of an optional runtime_id in the partition path allows for direct examination of the table path. This enables the straightforward identification of whether new runtime_id folders have been created after the backfilling operation.
If your backfilling addressed gaps using a source table, the most straightforward approach is to aggregate metrics from the source table and compare them with your target table. Crafting a query that replicates your ETL logic allows for a comprehensive comparison, albeit it may require a bit of time and effort. However, this query serves a dual purpose, not only aiding in immediate validation but also serving as a valuable tool for future checks. It is advisable to document and store such queries in your ETL documentation for ongoing use.
In instances where the backfilling focused solely on certain columns without introducing new rows to the table, an additional validation method involves scrutinizing the unchanged columns in comparison to their previous states. For instance, evaluating the sum of these columns before and after backfilling ensures that no unintended alterations have occurred in the unaffected areas.
To sum up, some best backfilling practices in data engineering are introduced in this article. We broke down the differences between backfilling and restating a table. Also the vital role of smart design in handling both regular tasks and backfilling adventures are stressed. We tackled the hurdles of the backfilling process, dealing with issues like data availability and keeping our downstream pals in the loop. Finally, we mentioned that data engineers need to be mindful of how their changes affect downstream users and must act responsibly when backfilling is needed.
All articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more. Register for freeSign in to your account
Written By
See all from Naser Tamimi BackfillDataData EngineeringData ScienceProgramming Share This Article
Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program. Write for TDS
Programming A deep dive into Python virtual environments, pip and avoiding entangled dependencies Mike Huls June 14, 20219 min read
Artificial Intelligence Build your own ML-assisted labelling tool on Colab and try your hand at a game-changing no-code data labeling tool from Datature Lai Woen Yon December 20, 202110 min read
Artificial Intelligence Track ML Workflow for your Data Science Projects with ML Flow Vatsal May 4, 20227 min read
Machine Learning Reveal the hidden insights in your JSON embedded columns Mikio Harman January 19, 20214 min read
Machine Learning A hands-on guide to tracking experiments, logging models, and reproducing results with ML Flow. Alex Davis July 21, 20267 min read
Data Science What they don't teach you in statistics Shaw Talebi November 11, 202312 min read
Machine Learning Tips to maximize output without working more Vicky Yu March 27, 20214 min read
Artificial Intelligence Distribution plots are of crucial importance for EDA Soner Yıldırım June 9, 20215 min read
Programming You have heard about integrated time-series data but what about cointegration? Sarem Seitz August 25, 20225 min read
Your home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals. Subscribe to Our NewsletterWrite For TDS•About•Advertise•Privacy Policy•Terms of Use © Insight Media Group, LLC 2026•The New Stack•roadmap.sh•Creator Network