Git Product home page Git Product logo

kompare's Introduction

kompare

Python CLI to compare documents in elasticsearch and dynamodb and identify the difference

Installation

$ git clone https://github.com/radiantone/kompare
$ cd kompare
$ make install
$ source venv/bin/activate

Overview

kompare is a CLI tool for comparing synchronization between elasticsearch indices and dynamodb tables in either direction depending on which is your source of truth (usually it will be dynamodb).

Configuration

When you run elasticsearch container you need to copy the password it shows in the logs to the PASSWORD field of the url in the ini file below.

$ more kompare.ini 
[elasticsearch]
url=https://elastic:PASSWORD@localhost:9200

[dynamodb]
url=http://localhost:8009

Usage

(venv) $ kompare
Usage: kompare [OPTIONS] COMMAND [ARGS]...

Options:
  --debug  Debug switch
  --help   Show this message and exit.

Commands:
  dyn2es   Scan dynamodb and find matches in elasticsearch
  es2dyn   Scan elasticsearch and find matches in dynamodb
  indices  List elasticsearch indices
  tables   List dynamodb tables

(venv) $ kompare indices
test-index
(venv) $ kompare tables
test

(venv) $ kompare es2dyn -eid id -did id -i test-index -t test
Scanning |################################| 3/3
+--------------+------------+----------------+---------------+--------+-------+
| Dynamo Table |  ES Field  | DynamoDB Field | Elastic Index | Misses | Total |
+--------------+------------+----------------+---------------+--------+-------+
|     test     | test-index |       id       |       id      |   2    |   3   |
+--------------+------------+----------------+---------------+--------+-------+

(venv) $ kompare dyn2es -eid id -did id -i test-index -t test
Scanning |################################| 1/1
+--------------+------------+----------------+---------------+--------+-------+
| Dynamo Table |  ES Field  | DynamoDB Field | Elastic Index | Misses | Total |
+--------------+------------+----------------+---------------+--------+-------+
|     test     | test-index |       id       |       id      |   0    |   1   |
+--------------+------------+----------------+---------------+--------+-------+

Testing

To test the tool locally you can use docker compose to bring up elasticsearch and dynamodb local instances

$ docker compose up

Then update the scripts/insert.py script to match the PASSWORD reported by elasticsearch container and run it

$ python scripts/insert.py

For dynamodb, point your browser to http://localhost:8009 then create a table and add a document do it with an id field.

kompare's People

Stargazers

Darren Govoni avatar

Watchers

Kostas Georgiou avatar Darren Govoni avatar  avatar

Forkers

cronusone

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.