Data Integration Approach to Maximize your RoI

Data Integration Approach

The data Integration approach adopted by many data integration projects relies on a set of premium tools leading to cash burnout with RoI less than the standard. 

To overcome this and to maximize the RoIwe lay down a data integration approach that makes use of open-source tools over the premium to deliver better results. and an even more confident return on the investment.  

Adopt a two-stage data integration approach:

Part 1 explains the process of setting up technicals and part 2 covers the execution approach involving challenges faced and solutions to the same.

Part 1: Setting Up

The following are the widely relied data sources: 

  1. REST API Source with standard NoSQL JSON (with nested datasets) 
  2. REST API Source with full data schema in JSON 
  3. CSV Files in AWS S3 
  4. Relational Tables from Postgres DB 

There are 2 different JSON types above in which the former is conventional, and the latter is here

Along with the data movement, it is necessary to facilitate Plug-n-Play architecture, Notifications, Audit data for Reporting, Un-burdened Intelligent scheduling, and setting up all the necessary instances. 

The landing Data warehouse chosen was AWS Redshift which is a one-stop for the operational data stores (ODS) as well as facts & dimensions. As said, we completely relied on open-source tools over the tools from tech giants like Oracle, Microsoft, Informatica, Talend, etc. 

The data integration was successful by leveraging Python, SQL, and Apache Airflow to do all the work. Use Python for Extraction; SQL to Load & Transform the data and Airflow to orchestrate the loads via python-based scheduler code. Below is the data flow architecture.

data flow architecture

Data Flow Architecture

Part 2: Execution 

The above data flow architecture gives a fair idea of how the data was integrated. The execution is explained in parallel with the challenges faced and how they were solved. 

Challenges:

  1. Plug-n-Play Model.  
  2. Dealing with the nested data in JSON. 
  3. Intelligent Scheduling. 
  4. Code Maintainability for future enhancements.  

1. Plug-n-Play Model

To meet the changing business needs, the addition of columns or a datastore is obvious and if the business is doing great, expansion to different regions is apparent. The following aspects were made sure to ensure a continuous integration process.

  • A new column will not break the process. 
  • A new data store should be added with minimal work by a non-technical user. 
  • To bring down the time consumed for any new store addition(expansion) integration from days to hours.  

The same is achieved by using: 

  • config table which is the heart of the process holding all the jobs needed to be executed, their last extract dates, and parameters for making the REST API call/extract data from RDBMS. 
  • Re-usable python templates which are read-modified-executed based on the parameters from the config table. 
  • Audit table for logging all the crucial events happening whilst integration. 
  • Control table for mailing and Tableau report refreshes after the ELT process

By creating state-of-art DAGs which can generate DAGs(jobs) with configuration decided in the config table for that particular job. 

Any new table which is being planned for the extraction or any new store being added as part of business expansion needs its entries into the config table. 

The DAG Generator DAG run will build jobs for you in a snap which will be available in Airflow UI on the subsequent refresh within seconds, and the new jobs are executed on the next schedule along with existing jobs. 

2. Dealing with the nested data in JSON.

It is a fact that No-SQL JSONS hold a great advantage from a storage and data redundancy perspective but add a lot of pain while reading the nested data out of the inner arrays. 

The following approach is adopted to conquer the above problem: 

  • Configured AWS Redshift Spectrum, with IAM Role and IAM Policy as needed to access AWS Glue Catalog and associating the same with AWS Redshift database cluster 
  • Created external database, external schema & external tables in AWS Redshift database 
  • Created AWS Redshift procedures with specific syntax to read data in the inner array

AWS Redshift was leveraged to parse the data directly from JSON residing in AWS S3 onto an external table (no loading is involved) in AWS Redshift which was further transformed to rows and columns as needed by relational tables. 

3. Intelligent Scheduling

There were multiple scenarios in orchestration needs: 

  • Time-based – Batch scheduling; MicroELTs ran to time & again within a day for short intervals. 
  • Event-based – File drop in S3 

For the batch scheduling, neither the jobs were run all in series (since it is going to be an underutilization of resources and a time-consuming process) nor in parallel as the workers in airflow will be overwhelmed.  

A certain number of jobs were automated to keep running asynchronously until all the processes were completed. By using a python routine to do intelligent scheduling. The code reads the set of jobs being executed as part of the current batch into a job execution/job config table and keeps running those four jobs until all the jobs are in a completed/failed state as per the below logical flow diagram. 

Logical Flow Diagram_data integration approach

Logical Flow Diagram

For Event-based triggering, a file would be dropped in S3 by an application, and the integration process will be triggered by reading this event and starts the loading process to a data warehouse. 

The configuration is as follows: 

  • CloudWatch event which will trigger a Lambda function which in turn makes an API call to trigger Airflow DAG 

4. Code Maintainability for future enhancements

A Data Integration project is always collaborative work and maintaining the correct source code is of dire importance. Also, if a deployment goes wrong, the capability to roll back to the original version is necessary. 

For projects which involve programming, it is necessary to have a version control mechanism. To have that version control mechanism, configure the GIT repository to hold the DAG files in Airflow with Kubernetes executor.

Take away:

This data integration approach is successful in completely removing the premium costs while decreasing the course of the project. All because of the reliance on open-source tech and utilizing them to the fullest. 

By leveraging any ETL tool in the market, the project duration would be beyond 6 months as it requires building a job for each operational data store. The best-recommended option is using scripting in conjunction with any ETL tool to repetitively build jobs that would more or less fall/overlap with the way it is now executed.  

Talk to our Data Integration experts:

Looking for a one-stop location for all your integration needs? Our data integration experts can help you align your strategy or offer you a consultation to draw a roadmap that quickly turns your business data into actionable insights with a robust Data Integration approach and a framework tailored for your specs. 

Related posts