Giter Site home page Giter Site logo

panama_papers_sql's Introduction

Data Parsing and Database Insertion Script

Overview

This script parses data from CSV files and inserts it into a PostgreSQL database. The data includes information about entities, officers, roles, addresses, intermediaries, and relationships between them.

Contact me for the sample CSV files i used.

Prerequisites

  • Python 3
  • PostgreSQL database
  • Python virtual enviroment

Installation

  1. Install the required Python packages:

    pip install -r requirements.txt

Usage

  1. Ensure that your CSV files are placed in the same folder as the script.

  2. Create a PostgreSQL database with the necessary credentials.

  3. Run the script with the following command:

    python parser.py -H <hostname> -p <port> -U <username> -P <password> -d <database>

    Replace <hostname>, <port>, <username>, <password>, and <database> with your PostgreSQL database connection details.

Files in the Same Folder

  • queries.sql: SQL script for creating the database schema.

  • csv_panama_papers/: Place your CSV files in this folder.

Notes

  • This repository provides two methods for using the parser:

    1. Automated Setup:

      • Run the parser_automated.py script after initializing the PostgreSQL database. Refer to the usage instructions for the code snippet.
      • This automated process will create the necessary database schema and parse the data automatically.
    2. Manual Setup:

      • Execute the schema.sql script to manually create the database schema.
      • Run the parser.py script (as described in the usage section).
      • This will generate a substantial .sql file named data.sql (approximately 400MB).
      • Execute the generated data.sql file to insert the parsed data into the database.

Choose the method that best fits your requirements and workflow. If you opt for the automated setup, the entire process, including schema creation and data parsing, is handled in a single step. For manual setup, you have more control over the individual steps, allowing for customization or troubleshooting as needed.

panama_papers_sql's People

Contributors

dimcel avatar

Watchers

 avatar

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.