Skip to main content

PostgreSQL. Database migration and seeds tool for postgres by using psycopg2 with python3.

Project description

WALK

Walk is a simple python migrations tool for postgres databases. The application is based on 'psycopg2' to run sql commands.

Installation

Download the this git repository and than inside the root folder of the repository.

pip3 install -e .

Configuration

Intialize default configurations file 'walk_config.json'.

walk --init

The default walk_config.json looks like this.

{
    "test": [
        "user=postgres",
        "dbname=test"
    ],
    "dev": [
        "user=postgres",
        "dbname=dev"
    ],
    "prod": [
        "user=postgres",
        "dbname=prod",
        "password=pw"
    ]
}

Passing db config parameters directly to the command. The config attributes in the config file which are also included in the command paramters list will be ignored.

"dev": {
    "dbname=test"
}

walk -p dbname=prod -p password=pw -e dev

-> dbname=prod will be taken

For more configuration parameters look inside the documentation of the 'psycopg2' connection class. Here

Migrations sql file

To create a new migrations file inside the migrations folder. Use the following command. The default datbase environment is 'dev'.

walk --new test_file_name --env dev

Execute migrations

To execute the migration files for the 'dev' database enviroment use the following command.

walk --migrate --env dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

walk-0.2.3.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

walk-0.2.3-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page