GithubHelp home page GithubHelp logo

thepandaguitar / ip_overlap_pg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coderholic/ip_overlap_pg

0.0 0.0 0.0 148 KB

PostgreSQL-based IP overlap

License: MIT License

PLpgSQL 94.52% Shell 5.48%

ip_overlap_pg's Introduction

ip_overlap_pg

PostgreSQL-based IP overlap

Usage

Clone this repository:

$ git clone https://github.com/pshevtsov/ip_overlap_pg.git
$ cd ip_overlap_pg

After that you need to download net_combined.csv into the current directory:

$ wget https://s3.amazonaws.com/idb.io/net_combined.csv

Then use one of the following ways:

  1. Docker containers
  2. Local environment

Docker containers

Requirements

  1. Docker
  2. Docker Compose
  3. pgloader

Usage

First of all you need to buid the necessary containers:

$ docker-compose build

After that you need to start the database container instance:

$ docker-compose up -d db

Then you need to run CSV processing application:

$ docker-compose run app

After the processing finishes you can get the final CSV output:

$ docker run -it --link $(docker-compose ps -q db):postgres --rm postgres sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -d postgres -c "COPY ( SELECT * FROM net_flat ORDER BY s ) TO STDOUT WITH CSV"' > output.csv

The file output.csv will contain the processed data.

Local environment

Requirements

  1. pgloader
  2. PostgreSQL

Usage

First of all you need to load CSV data into PostgreSQL database table:

$ POSTGRES_URL=postgresql://postgres@localhost:5432/postgres?net_combined pgloader command.load

Set POSTGRES_URL to the correct connection string. Note: the table name must be net_combined.

After that you can get the processed output:

$ psql -h localhost -p 5432 -U postgres -d postgres -c "COPY ( SELECT * FROM net_flat ORDER BY s ) TO STDOUT WITH CSV"' > output.csv

Set the correct parameters for psql command. The file output.csv will contain the processed data.

ip_overlap_pg's People

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.