Skip to main content

Pyway is a database versioning and migration tool inspired by Flyway

Project description

Pyway Database Version Control

version number: 0.3.8

Overview

Pyway is a database versioning and migration tool inspired by Flyway

Download and Install

To install use pip:

$ pip install pyway

Or clone the repo:

$ git clone https://github.com/jasondcamp/pyway.git
$ python setup.py install

Configuration

Pyway environment variables and command line options

Env Variable Command Line Description Default
PYWAY_DATABASE_MIGRATION_DIR --database-migration-dir Folder name to migration files resources
PYWAY_SQL_MIGRATION_PREFIX Prefix for version in migration file V
PYWAY_SQL_MIGRATION_SEPARATOR Separator between version and description to the migration file __
PYWAY_SQL_MIGRATION_SUFFIXES Suffix extension for migration files .sql
PYWAY_TABLE --database-table Name of schema history table public.pyway
PYWAY_TYPE --database-type Data Base Management System [postgres, mysql ] required
PYWAY_DATABASE_HOST --database-host Host to connect to the database localhost
PYWAY_DATABASE_PORT --database-port Port to connect to the database 5432
PYWAY_DATABASE_NAME --database-name Name of database to connect postgres
PYWAY_DATABASE_USERNAME --database-username User to use to connect to the database postgres
PYWAY_DATABASE_PASSWORD --database-password Password to use to connect to the database None
PYWAY_LOGS_DIR --logs-dir Folder name to logs construct logs
--log-to-file Log to external file False
PYWAY_CONFIG_FILE -c, --config Configuration file .pyway.conf

Configuration file

Pyway supports a configuration file with the default file as .pyway.conf. A sample config file is below:

database:
    type: postgres
    username: postgres
    password: 123456
    host: localhost
    port: 5432
    database: postgres
logging:
    logsdir: logs
    logtofile: False
general:
    migrationsdir: schema
    pywaytable: public.pyway

Pyway Files

Files are raw SQL files that are named like the following:

V{major}_{minor}__{description}.sql

Example: V01_01__initial_schema.sql

Note that the description needs to match the word regexp [A-Za-z0-9_]

Usage

Info

Information lets you know where you are. At first glance, you will see which migrations have already been applied, which others are still pending, and whether there is a discrepancy between the checksum of the local file and the database schema table.

$ pyway info

Validate

Validate helps you verify that the migrations applied to the database match the ones available locally. This compares the checksums to validate that what is in the migration on disk is what was committed into the database.

$ pyway validate

Migrate

After validate, it will scan the Database migration dir for available migrations. It will compare them to the migrations that have been applied to the database. If any new migration is found, it will migrate the database to close the gap.

$ pyway migrate

Import

This allows the user to import a schema file into the migration, for example if the base schema has already been applied, then the user can import that file in so they can then apply subsequent migrations.

$ pyway import --schema-file V01_01__initial_schema.sql

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

pyway-0.3.8.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyway-0.3.8-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file pyway-0.3.8.tar.gz.

File metadata

  • Download URL: pyway-0.3.8.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.14

File hashes

Hashes for pyway-0.3.8.tar.gz
Algorithm Hash digest
SHA256 04cc344ad942430626adb564bd879310b1b544b4cfc906a94c3d7122d89dc4d0
MD5 34db98a7a52de9f9964d0430e39948ff
BLAKE2b-256 610293cd16130f4d2b838a232051fdc127570a2992cd8e6b959f89e3cbe716ea

See more details on using hashes here.

File details

Details for the file pyway-0.3.8-py3-none-any.whl.

File metadata

  • Download URL: pyway-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.14

File hashes

Hashes for pyway-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 174e97a6257114f8a4a191fc94f3959edc5063ece876bdde7b49ca4d635c3902
MD5 475aaf6c2fea1bcfba82ae9ac79c5758
BLAKE2b-256 f000d1e2567215ba67f4e590c51f3fe05a0fd35bbc32e9744dd26f1668f8a747

See more details on using hashes here.

Supported by

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