Skip to main content

Python liquibase

Project description

pyliquibase

A Python module to use liquibase in python, using the Java Native Interface (JNI).

Documentation License contributions welcome Create Pypi Release

For full documentation, please visit https://memiiso.github.io/pyliquibase/

Installation

Python-Java integration requires Java. Ensure Java is installed on your operating system.

pip install pyliquibase

Quick Start

using command line:

pyliquibase --defaultsFile=changelogs/liquibase.properties status
pyliquibase --defaultsFile=changelogs/liquibase.properties validate
pyliquibase --defaultsFile=changelogs/liquibase.properties updateSQL
pyliquibase --defaultsFile=changelogs/liquibase.properties update

using python:

from pyliquibase import Pyliquibase

if __name__ == '__main__':
    liquibase = Pyliquibase(defaultsFile="changelogs/liquibase.properties", logLevel="INFO")
    # call execute with arguments
    liquibase.execute("status")
    liquibase.execute("rollback", "MyTag")
    # or 
    liquibase.validate()
    liquibase.status()
    liquibase.updateSQL()
    liquibase.update()
    liquibase.update_to_tag("MyTag")
    liquibase.rollback("MyTag")
    # liquibase maintenance commands
    liquibase.changelog_sync()
    liquibase.changelog_sync_to_tag("MyTag")
    liquibase.clear_checksums()
    liquibase.release_locks()

Python Java Integration

This Python library integrates with Java using the LiquibaseCommandLine class. Our Python LiquibaseCommandLine class acts as a reflection of the Java counterpart, passing Liquibase calls to the Java LiquibaseCommandLine.execute(liquibaseargs) method.

This integration leverages JPype1, a Python library for accessing Java classes. JPype starts a Java Virtual Machine (JVM) within the current process or connects to an existing JVM. For more information on JPype, please refer to their documentation: https://jpype.readthedocs.io/en/latest/.

import jpype
# ... setup classpath ...
jpype.startJVM(classpath=LIQUIBASE_CLASSPATH, convertStrings=True)
liquibase_cli = jpype.JClass("liquibase.integration.commandline.LiquibaseCommandLine")()
liquibase_cli.execute(args)

Contributors

LIQUIBASE is a registered trademark of Liquibase , INC.

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

pyliquibase-3.0.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

pyliquibase-3.0.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file pyliquibase-3.0.0.tar.gz.

File metadata

  • Download URL: pyliquibase-3.0.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyliquibase-3.0.0.tar.gz
Algorithm Hash digest
SHA256 271fd877427ac00a2dead6faa296be4ec3a457190460bc7cb77edb601c2bfbcb
MD5 7864bc4a65b84aa1db92f1c988602274
BLAKE2b-256 8b6415d2f6f68ac7eb4469f92f5a3c12641c57a536f650e8946566fd0d588552

See more details on using hashes here.

File details

Details for the file pyliquibase-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyliquibase-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyliquibase-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75cb07f14afa44d55f49684d34cc88ece84cbf27c6539a4d9650bb598272d54d
MD5 9ed6495e9c3291215a3d4459a417057c
BLAKE2b-256 7230e349112f42b19d65362b198a419a6b218c455dc430bcf7939d7ed36776d6

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