Git Product home page Git Product logo

data_verifier's Introduction

data_verifier

Maintenance Open Source Love Gem Version HitCount Gem Downloads Build Status Twitter Follow

There are times when we change the approach of modifying data and want to verify that the data modified by the new approach is same as the old approach. This gem is build for such verifications.

Motivation

In my project, we replicate the data from other systems. There was a requirement where we changed the source of the data and code to replicate the data to our system. In testing phase we wanted to create a validation sheet, which can show the difference b/w the data in our system before and after the new source.

Installation

Add this line to your application's Gemfile:

gem 'data_verifier'

Usage

This gem has to be used in two phases:

  1. Build Phase: Use this phase to build the baseline of the data before changing the code/approach
  2. Verification Phase: Use this phase to verify the new data against the baseline data

Config:

require 'data_verifier'

QUERIES = {
    users_table: "select * from users where id=100",
    phones_table: "select * from phones where user_id=100",
    addresses_table: "select * from addresses where user_id=100",
}

config = DataVerifier::Config.new do |c|
  c.db_adapter = :oracle
  c.db_user = 'my_db_user'
  c.db_password = 'my_pass'
  c.db_host = 'localhost'
  c.db_name = 'test_db'
  c.db_port = '1521'
  c.data_identifier = 'user_id_100'
  c.queries = QUERIES
end

Inspector

Create an inspector to run in both build and verify mode.

configs = [config1, config2, config3]
inspector = DataVerifier::Inspector.new(configs, report_name: 'my_awesome_report')

Building Baseline Data:

The below code will execute all the queries and store their result in json files.

inspector.inspect(phase: :BUILD)

Verification:

Below code will again execute the queries and will compare it with the baseline data. After comparision it will create an excel file of the result.

inspector.inspect(phase: :VERIFY)

Result:

License

MIT License

Copyright (c) 2019 Ajit Singh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.