Skip to main content

Python liquibase

Project description

License contributions welcome Create Pypi Release

pyliquibase

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

For further details on python-java integration please see here

Installation

install:

pip install pyliquibase

install from github:

pip install https://github.com/memiiso/pyliquibase/archive/master.zip --upgrade --user

How to Use

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

Python library is based on LiquibaseCommandLine Python class. It is reflection of Java LiquibaseCommandLine class. liquibase calls are passed to Java LiquibaseCommandLine.execute(liquibaseargs) method.

Pyjnius is a Python library for accessing Java classes. It either starts a new JVM inside the process, or retrieves the already surrounding JVM. To read more on pyjnius please see https://pyjnius.readthedocs.io/en/latest/

class LiquibaseCommandLine(JavaClass, metaclass=MetaJavaClass):
    __javaclass__ = 'liquibase/integration/commandline/LiquibaseCommandLine'
    # methods
    execute = JavaMethod('([Ljava/lang/String;)I')

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-2.3.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

pyliquibase-2.3.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyliquibase-2.3.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyliquibase-2.3.1.tar.gz
Algorithm Hash digest
SHA256 f44a62cc531896ddcfd85dcca6ea105e9735441cbdd911a6cd80328369d070f8
MD5 aad123305824aac2fcf0c0fd5c0a145a
BLAKE2b-256 150a9eef559abfd4a3fd6b3091dcc0ee7a6a25f962f12ca83a4e589421fb258d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyliquibase-2.3.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyliquibase-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e65db84f9a773f29d6bbcf63658d02088bf53f47ac87cacf2edd8d712179b686
MD5 df82dcc178918fe0f666abe623df189f
BLAKE2b-256 250634e41b40c4287590d2c9e7ea68151b5552dc9011f68a0a8cf73bae5e1168

See more details on using hashes here.

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