Many enterprises are migrating their on-premises knowledge shops to the AWS Cloud. Throughout knowledge migration, a key requirement is to validate all the information that has been moved from supply to focus on. This knowledge validation is a vital step, and if not finished appropriately, might consequence within the failure of your complete mission. Nevertheless, growing customized options to find out migration accuracy by evaluating the information between the supply and goal can typically be time-consuming.
On this put up, we stroll by way of a step-by-step course of to validate massive datasets after migration utilizing a configuration-based device utilizing Amazon EMR and the Apache Griffin open supply library. Griffin is an open supply knowledge high quality answer for giant knowledge, which helps each batch and streaming mode.
In in the present day’s data-driven panorama, the place organizations take care of petabytes of knowledge, the necessity for automated knowledge validation frameworks has develop into more and more vital. Guide validation processes will not be solely time-consuming but in addition susceptible to errors, particularly when coping with huge volumes of knowledge. Automated knowledge validation frameworks provide a streamlined answer by effectively evaluating massive datasets, figuring out discrepancies, and guaranteeing knowledge accuracy at scale. With such frameworks, organizations can save beneficial time and sources whereas sustaining confidence within the integrity of their knowledge, thereby enabling knowledgeable decision-making and enhancing general operational effectivity.
The next are standout options for this framework:
- Makes use of a configuration-driven framework
- Presents plug-and-play performance for seamless integration
- Conducts depend comparability to establish any disparities
- Implements strong knowledge validation procedures
- Ensures knowledge high quality by way of systematic checks
- Supplies entry to a file containing mismatched data for in-depth evaluation
- Generates complete stories for insights and monitoring functions
Resolution overview
This answer makes use of the next providers:
- Amazon Easy Storage Service (Amazon S3) or Hadoop Distributed File System (HDFS) because the supply and goal.
- Amazon EMR to run the PySpark script. We use a Python wrapper on prime of Griffin to validate knowledge between Hadoop tables created over HDFS or Amazon S3.
- AWS Glue to catalog the technical desk, which shops the outcomes of the Griffin job.
- Amazon Athena to question the output desk to confirm the outcomes.
We use tables that retailer the depend for every supply and goal desk and likewise create information that present the distinction of data between supply and goal.
The next diagram illustrates the answer structure.
Within the depicted structure and our typical knowledge lake use case, our knowledge both resides n Amazon S3 or is migrated from on premises to Amazon S3 utilizing replication instruments akin to AWS DataSync or AWS Database Migration Service (AWS DMS). Though this answer is designed to seamlessly work together with each Hive Metastore and the AWS Glue Knowledge Catalog, we use the Knowledge Catalog as our instance on this put up.
This framework operates inside Amazon EMR, robotically operating scheduled duties each day, as per the outlined frequency. It generates and publishes stories in Amazon S3, that are then accessible through Athena. A notable characteristic of this framework is its functionality to detect depend mismatches and knowledge discrepancies, along with producing a file in Amazon S3 containing full data that didn’t match, facilitating additional evaluation.
On this instance, we use three tables in an on-premises database to validate between supply and goal : balance_sheet
, covid
, and survery_financial_report
.
Conditions
Earlier than getting began, be sure you have the next stipulations:
Deploy the answer
To make it simple so that you can get began, now we have created a CloudFormation template that robotically configures and deploys the answer for you. Full the next steps:
- Create an S3 bucket in your AWS account referred to as
bdb-3070-griffin-datavalidation-blog-${AWS::AccountId}-${AWS::Area}
(present your AWS account ID and AWS Area). - Unzip the next file to your native system.
- After unzipping the file to your native system, change <bucket title> to the one you created in your account (
bdb-3070-griffin-datavalidation-blog-${AWS::AccountId}-${AWS::Area}
) within the following information:bootstrap-bdb-3070-datavalidation.sh
Validation_Metrics_Athena_tables.hql
datavalidation/totalcount/totalcount_input.txt
datavalidation/accuracy/accuracy_input.txt
- Add all of the folders and information in your native folder to your S3 bucket:
- Run the next CloudFormation template in your account.
The CloudFormation template creates a database referred to as griffin_datavalidation_blog
and an AWS Glue crawler referred to as griffin_data_validation_blog
on prime of the information folder within the .zip file.
- Select Subsequent.
- Select Subsequent once more.
- On the Assessment web page, choose I acknowledge that AWS CloudFormation would possibly create IAM sources with customized names.
- Select Create stack.
You possibly can view the stack outputs on the AWS Administration Console or through the use of the next AWS CLI command:
- Run the AWS Glue crawler and confirm that six tables have been created within the Knowledge Catalog.
- Run the next CloudFormation template in your account.
This template creates an EMR cluster with a bootstrap script to repeat Griffin-related JARs and artifacts. It additionally runs three EMR steps:
- Create two Athena tables and two Athena views to see the validation matrix produced by the Griffin framework
- Run depend validation for all three tables to check the supply and goal desk
- Run record-level and column-level validations for all three tables to check between the supply and goal desk
- For SubnetID, enter your subnet ID.
- Select Subsequent.
- Select Subsequent once more.
- On the Assessment web page, choose I acknowledge that AWS CloudFormation would possibly create IAM sources with customized names.
- Select Create stack.
You possibly can view the stack outputs on the console or through the use of the next AWS CLI command:
It takes roughly 5 minutes for the deployment to finish. When the stack is full, it is best to see the EMRCluster
useful resource launched and accessible in your account.
When the EMR cluster is launched, it runs the next steps as a part of the post-cluster launch:
- Bootstrap motion – It installs the Griffin JAR file and directories for this framework. It additionally downloads pattern knowledge information to make use of within the subsequent step.
- Athena_Table_Creation – It creates tables in Athena to learn the consequence stories.
- Count_Validation – It runs the job to check the information depend between supply and goal knowledge from the Knowledge Catalog desk and shops the ends in an S3 bucket, which might be learn through an Athena desk.
- Accuracy – It runs the job to check the information rows between the supply and goal knowledge from the Knowledge Catalog desk and retailer the ends in an S3 bucket, which might be learn through the Athena desk.
When the EMR steps are full, your desk comparability is finished and able to view in Athena robotically. No handbook intervention is required for validation.
Validate knowledge with Python Griffin
When your EMR cluster is prepared and all the roles are full, it means the depend validation and knowledge validation are full. The outcomes have been saved in Amazon S3 and the Athena desk is already created on prime of that. You possibly can question the Athena tables to view the outcomes, as proven within the following screenshot.
The next screenshot exhibits the depend outcomes for all tables.
The next screenshot exhibits the information accuracy outcomes for all tables.
The next screenshot exhibits the information created for every desk with mismatched data. Particular person folders are generated for every desk straight from the job.
Each desk folder incorporates a listing for every day the job is run.
Inside that particular date, a file named __missRecords
incorporates data that don’t match.
The next screenshot exhibits the contents of the __missRecords
file.
Clear up
To keep away from incurring extra costs, full the next steps to wash up your sources while you’re finished with the answer:
- Delete the AWS Glue database
griffin_datavalidation_blog
and drop the databasegriffin_datavalidation_blog
cascade. - Delete the prefixes and objects you created from the bucket
bdb-3070-griffin-datavalidation-blog-${AWS::AccountId}-${AWS::Area}
. - Delete the CloudFormation stack, which removes your extra sources.
Conclusion
This put up confirmed how you need to use Python Griffin to speed up the post-migration knowledge validation course of. Python Griffin helps you calculate depend and row- and column-level validation, figuring out mismatched data with out writing any code.
For extra details about knowledge high quality use instances, seek advice from Getting began with AWS Glue Knowledge High quality from the AWS Glue Knowledge Catalog and AWS Glue Knowledge High quality.
In regards to the Authors
Dipal Mahajan serves as a Lead Advisor at Amazon Internet Providers, offering knowledgeable steering to international purchasers in growing extremely safe, scalable, dependable, and cost-efficient cloud functions. With a wealth of expertise in software program improvement, structure, and analytics throughout various sectors akin to finance, telecom, retail, and healthcare, he brings invaluable insights to his position. Past the skilled sphere, Dipal enjoys exploring new locations, having already visited 14 out of 30 international locations on his want listing.
Akhil is a Lead Advisor at AWS Skilled Providers. He helps prospects design & construct scalable knowledge analytics options and migrate knowledge pipelines and knowledge warehouses to AWS. In his spare time, he loves travelling, taking part in video games and watching films.
Ramesh Raghupathy is a Senior Knowledge Architect with WWCO ProServe at AWS. He works with AWS prospects to architect, deploy, and migrate to knowledge warehouses and knowledge lakes on the AWS Cloud. Whereas not at work, Ramesh enjoys touring, spending time with household, and yoga.