Pyquibase
Pyquibase is a Python wrapper for liquibase. There are other liquibase wrapper for python but they all require change log files to be in YAML format. Since I want to use xml file for liquibase, I built my own liquibase wrapper for python. Athough I use Pyquibase with xml files only, it should also work with other file types.
Installation
pip install pyquibase
Usage
Currently it supports Sqlite, MySql, and Postgresql
Update
sqlite
from pyquibase.pyquibase import Pyquibase
if __name__ == '__main__':
pyquibase = Pyquibase.sqlite('test.sqlite', 'db-changelog-1.xml')
pyquibase.update()
MySQL
from pyquibase.pyquibase import Pyquibase
if __name__ == '__main__':
pyquibase = Pyquibase.mysql(
host = 'localhost',
port = 3306,
db_name = 'pyquibase',
username = 'root',
password = 'test',
change_log_file = 'db-changelog-1.xml'
)
pyquibase.update()
Postgresql
from pyquibase.pyquibase import Pyquibase
if __name__ == '__main__':
pyquibase = Pyquibase.postgresql(
host = 'localhost',
port = 3306,
db_name = 'pyquibase',
username = 'root',
password = 'test',
change_log_file = 'db-changelog-1.xml'
)
pyquibase.update()
Rollback
pyquibase.rollback('tag')