Skip to main content

AQ-DBMigration

a db migration tool in python

home

github: nanshens/AQ-DBMigration

install

pip install aq-dbmigration

how to use

    config = MigrationConfig("db_name", "db_user", "db_password", "db_host", "db_port", DBConstant.Type.PostgreSQL, "db file path")
    db = DBMigration(config)
    db.migration()

if you want to skip migration, you can set skip is True in db.migration(), like this:

    db.migration(True)

sql file

file format: V{version}__{description}.sql
example: V1__test.sql, V2__issue1.sql, V2.1__issue11.sql, V2.12__issue12.sql

version: version = main sequence + . + sub sequence, so order by main first, then sub. example: V1.2 run first and V1.13 second, because 2 < 13.

please start from V1

MigrationConfig

file path

please use absolute path.
if you use flask, you can set db_path in flask config, like this app.config['DB_MIGRATION_PATH'] = os.path.join(app.root_path, 'resource', 'db_migration') and use MigrationConfig("db_name", "db_user", "db_password", "db_host", "db_port", DBConstant.Type.PostgreSQL, app.config['DB_MIGRATION_PATH']) to init

baseline

When used for the first time, it will set the baseline, and subsequent changes will not take effect.
Only read sql files larger than baseline.

database support

  1. postgresql(tested pass)
  2. mysql(in testing)
  3. maria(in testing)
  4. sqlite(in testing)

License

This project is licensed under the terms of the GNU General Public License v3.0.

Metadata

Release files for aq-dbmigration 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aq-dbmigration 1.0.2
File Size Uploaded Provenance
aq_dbmigration-1.0.2.tar.gz 17.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aq-dbmigration 1.0.2
File Interpreter ABI Platform
aq_dbmigration-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.4 kB

Release files / aq_dbmigration-1.0.2.tar.gz

Download URL aq_dbmigration-1.0.2.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4382ac99910a922eeaddfc7a6f0c3ef7be501f6bcb3bf805c5171f817627fc98
BLAKE2b-256 checksum
How to use checksums
5e31c1dd24dccd1aed7891daa6d0fcd7d5090c97655280030bc5f54c6f690532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / aq_dbmigration-1.0.2-py3-none-any.whl

Download URL aq_dbmigration-1.0.2-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bb04a52461222bd9c2d7898aa60dd1275b67db29c1fd2ff25091ca8759e06750
BLAKE2b-256 checksum
How to use checksums
28128dde99fb658cc7b46e72b24aae4fd404a311cfaa18cbe689d9f550da470a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for aq-dbmigration 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page