ephemeral-postgres-0.2.0
توضیحات
Start an ephemeral postgres instance for easy testing
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | ephemeral-postgres-0.2.0 |
| نام | ephemeral-postgres |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | jthacker |
| ایمیل نویسنده | thacker.jon@gmail.com |
| آدرس صفحه اصلی | https://github.com/jthacker/ephemeral_postgres |
| آدرس اینترنتی | https://pypi.org/project/ephemeral-postgres/ |
| مجوز | - |
# ephemeral-postgres
[](https://travis-ci.org/jthacker/ephemeral_postgres)
ephemeral-postgres is a python package for easily setting up, testing, and
finally tearing down postgres instances. It can be easily integrated in most
test suites but has been primarily used with pytest.
## Installation
```bash
pip install ephemeral-postgres
```
## Example
```python
import ephemeral_postgres
import psycopg2
with ephemeral_postgres.postgres() as uri:
con = psycopg2.connect(uri)
cur = con.cursor()
cur.execute('select * from pg_database')
for row in cur.fetchall():
print(row)
```
Alternatively, if you would like to run an external Postgres server, you can
override ephemeral_postgres from starting a new instance by setting the
environment variable `EPHEMERAL_POSTGRES_URI` accordingly. For example:
```bash
export EPHEMERAL_POSTGRES_URI="postgresql://postgres:postgres@localhost:5432/postgres"
python "import ephemeral_postgres; print(ephemeral_postgres.postgres()[0])"
```
## Developing
```bash
pip install -e .[test]
# run unit tests
pytest
```
نحوه نصب
نصب پکیج whl ephemeral-postgres-0.2.0:
pip install ephemeral-postgres-0.2.0.whl
نصب پکیج tar.gz ephemeral-postgres-0.2.0:
pip install ephemeral-postgres-0.2.0.tar.gz