Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/msztolcman/integresql-client-python

Python client for IntegreSQL
https://github.com/msztolcman/integresql-client-python

integration-testing integresql postgresql testing

Last synced: 2 days ago
JSON representation

Python client for IntegreSQL

Awesome Lists containing this project

README

        

integresql-client-python
========================

[![integresql-client-python version](https://img.shields.io/pypi/v/integresql-client-python.svg)](https://pypi.python.org/pypi/integresql-client-python)
[![integresql-client-python license](https://img.shields.io/pypi/l/integresql-client-python.svg)](https://pypi.python.org/pypi/integresql-client-python)
[![integresql-client-python python compatibility](https://img.shields.io/pypi/pyversions/integresql-client-python.svg)](https://pypi.python.org/pypi/integresql-client-python)
[![Downloads](https://static.pepy.tech/personalized-badge/integresql-client-python?period=total&units=international_system&left_color=grey&right_color=yellow&left_text=Downloads)](https://pepy.tech/project/integresql-client-python)
[![say thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/marcin%40urzenia.net)

Python client for [IntegreSQL](https://github.com/allaboutapps/integresql).

Current stable version
----------------------

0.9.2

Python version
--------------

`integresql-client-python` is tested against Python 3.8+. Older Python versions may work, or may not.

How to use
----------

```python
from integresql_client_python import IntegreSQL

integresql = IntegreSQL('template_directory')

# integresql.debug = True

with integresql as tpl:
with tpl.initialize() as dbinfo:
# dbinfo is None if template is already initialized
if dbinfo:
# connect and import fixtures
print("initialize db with fixtures with db data:", dbinfo)

db = tpl.get_database()
with db as dbinfo:
# connect and do whatever you want
print("Do your tests with db data:", dbinfo)

# or manually, you can use as many databases as you need or IntegreSQL will allow
dbinfo1 = db.open()
print("Do your tests", dbinfo1)
dbinfo2 = db.open()
print("Do your tests", dbinfo2)
dbinfo3 = db.open()
print("Do your tests", dbinfo3)
# connect and do whatever you want

# do not forget about closing resources:
db.close(dbinfo1)
db.close(dbinfo2)
db.close(dbinfo3)
```

Authors
-------

* Marcin Sztolcman ([[email protected]](mailto:[email protected]))

Contact
-------

If you like or dislike this software, please do not hesitate to tell me about
it via email ([[email protected]](mailto:[email protected])).

If you find a bug or have an idea to enhance this tool, please use GitHub's
[issues](https://github.com/msztolcman/integresql-client-python/issues).

ChangeLog
---------
### v0.9.2

* fixed a bug where test database was returned to pool after every test and got reused.
Renamed method `Database.close()` to `Database.mark_unmodified()`. Using
`Database` in `with` block doesn't return selected database to pool anymore.

### v0.9.1

* allow using multiple template paths

### v0.9.0

* first public version