WALK
Walk is a simple python migrations and seeds tool for postgres and mysql databases. The application is based on 'psycopg2' and mysql-connector-python to run sql commands.
Install pip
osx (Homebrew)
brew install python3
ubuntu (postgres and psycopg2 support)
sudo apt install python3-dev postgresql postgresql-contrib python3-psycopg2 libpq-dev
Installation
Download the this git repository and than inside the root folder of the repository.
pip3 install walk
Current Version
0.3.5
Configuration
Intialize default configurations file 'walk_config.json'.
walk --init
The default walk_config.json looks like this.
{
"test": [
"user=postgres",
"dbname=test",
"adapter=postgresql | mysql"
],
"dev": [
"user=postgres",
"dbname=dev",
"adapter=postgresql | mysql"
],
"prod": [
"user=postgres",
"dbname=prod",
"password=pw",
"adapter=postgresql | mysql"
]
}
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 -p adapter=postgresql -e prod
-> 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 database environment is 'dev'.
walk --new test_file_name
Execute migrations
To execute the migration files for the 'dev' database enviroment use the following command.
walk --migrate --env dev
Seeds sql file
To create a new seed file inside the seeds folder. Use the following command. The default database environment is 'dev'.
walk --newseed test_seed_name
Execute seeds
To execute the seed files for the 'dev' database enviroment use the following command. You can also combine the seeds and the migrations. Migrations will be executed first so that seeds can also access current db changes.
walk --seed --env dev
Load configuration values from .env
Have a look inside the .env.example file for mor information about the valid parameters.
Use the '-v' command line param to take config values from the .env file
waalk -m -e dev -v
Metadata
Release files for walk 0.3.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| walk-0.3.5.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| walk-0.3.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.5 kB
Release files / walk-0.3.5.tar.gz
| Download URL | walk-0.3.5.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
19b0a00d2a57efebcb3d8f58f11b45d17baace52df270a555906a89d2c5126e5
|
|
BLAKE2b-256 checksum How to use checksums |
afbf3b49d4798ca8c5207b4a3be2a4b7fcd95bf95fb3474ad3eb92a2d0305689
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / walk-0.3.5-py3-none-any.whl
| Download URL | walk-0.3.5-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddaf5ecde56cfe2d171af777201251ddfa7ea210319f0419dae2ac316306d997
|
|
BLAKE2b-256 checksum How to use checksums |
6e10bc6e634ad825df23021802f1d8a0e1aa41e922aeeafc9e8b09e9cbbba05d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|