Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/memiiso/pyliquibase
Use liquibase java application within python
https://github.com/memiiso/pyliquibase
continuous-deployment database-change-management-tool database-management database-migrations liquibase postgresql python
Last synced: about 10 hours ago
JSON representation
Use liquibase java application within python
- Host: GitHub
- URL: https://github.com/memiiso/pyliquibase
- Owner: memiiso
- License: apache-2.0
- Created: 2020-01-04T16:15:27.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-15T11:03:12.000Z (about 2 months ago)
- Last Synced: 2025-01-01T11:06:54.693Z (7 days ago)
- Topics: continuous-deployment, database-change-management-tool, database-management, database-migrations, liquibase, postgresql, python
- Language: Python
- Homepage:
- Size: 190 MB
- Stars: 46
- Watchers: 3
- Forks: 17
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![License](http://img.shields.io/:license-apache%202.0-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)
[![Create Pypi Release](https://github.com/memiiso/pyliquibase/actions/workflows/release.yml/badge.svg)](https://github.com/memiiso/pyliquibase/actions/workflows/release.yml)
# pyliquibaseA Python module to use [liquibase](http://www.liquibase.org/) in python, using the Java Native Interface (JNI).
For further details on python-java integration [please see here](#python-java-integration)
## Installation
install:
```shell
pip install pyliquibase
```install from github:
```shell
pip install https://github.com/memiiso/pyliquibase/archive/master.zip --upgrade --user
```## How to Use
using command line:
```shell
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:
```python
from pyliquibase import Pyliquibaseif __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](https://github.com/kivy/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/
```python
class LiquibaseCommandLine(JavaClass, metaclass=MetaJavaClass):
__javaclass__ = 'liquibase/integration/commandline/LiquibaseCommandLine'
# methods
execute = JavaMethod('([Ljava/lang/String;)I')
```##
LIQUIBASE is a registered trademark of [Liquibase](https://www.liquibase.com) , INC.