PostgreSQL Server compiled into a Python Wheel.
Project description
postgresql-wheel
A Python wheel for Linux containing a complete, self-contained, locally installable PostgreSQL database server.
All servers run as the Python process user in a local path, so this wheel does not require root or sudo privledges. Databases can be initialized in any directory.
Servers can be setup and torn down in test fixtures with no additional outside dependencies.
Currently this wheel only works for most flavors of Linux.
Postgres is compiled in the same "manylinux" environments provided by the cibuildwheel tool using Github Actions and directly archived into the wheel's "package_data".
The wheel can be installed with pip:
$ pip install postgresql-wheel
Postgres binaries in the package can be found in the directory pointed
to by the postgresql.pg_bin
global variable. Function wrappers
around all of the postgres binary programs, like initdb
and pg_ctl
functions are provided for convenience:
>>> from postgresql import initdb, pg_ctl
>>> initdb('-D testdatabase')
>>> pg_ctl('-D testdatabase -o "-p 5678" -l testdatabase.log start')
>>> import psycopg2
>>> c = psycopg2.connect("postgres://localhost:5678/postgres") # connect with local client
>>> with c.cursor() as q:
>>> q.execute("select version()")
>>> print(q.fetchall())
...
[('PostgreSQL 13.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3), 64-bit',)]
>>> pg_ctl('-D testdatabase stop)
For the purposes of testing, convenience functions are provided for setting up and tearing down databases:
>>> pgdata, con_str = postgresql.setup()
>>> postgresql.psql(f'-h {con_str} -c "select version()"')
>>> postgresql.teardown(pgdata)
There is also a pytest fixture called tmp_postgres
that returns a
new connection string to a temporary database local domain socket, and
can be used in a pytest:
>>> from postgresql import tmp_postgres
>>> def test_foo(tmp_postgres):
... postgresql.psql(f'-h {tmp_postgres} -c "select version()")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for postgresql_wheel-14.1.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78582e4b6ef91af29817c7119097d38d23c332f6cbb219a6d146df19a4766ed2 |
|
MD5 | d11bffa8c81b7d10239144e000a12613 |
|
BLAKE2b-256 | 5cbc52012222d93fe5662e77502deb3ad1301ad8147b0d62aa4ebb11ce756621 |
Hashes for postgresql_wheel-14.1.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bf95953d7dab821c0c3ab1a94676be1cee58820e6ed691e59c357f739495bc8 |
|
MD5 | f188f9b2da54e4b777255f9cc64e3bfa |
|
BLAKE2b-256 | 6af4ffe701d342b4a92f7a9673032217189dbddab1a7ad215f5141f3e2f5c661 |
Hashes for postgresql_wheel-14.1.1-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be390f1e4af6f5c318e9b9d5e0204af157f325eb6425fae165c12df757578748 |
|
MD5 | e5abc255897e6c1d6d6a9c2ca9547d3a |
|
BLAKE2b-256 | f5ad81980074637042b8c11089d49a533b2f8eb16cca0b59a767befba16fe4aa |
Hashes for postgresql_wheel-14.1.1-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 527228fe5bcda8cb6ee92313fd62f90ccef6e8d28054c3942e167748c3c93adf |
|
MD5 | 0750c63e7f731511370757832e09e5ad |
|
BLAKE2b-256 | ef74fd29bd3c4bd1ba3bf6f96e32f1f54cef2ac71cd95ea8213c51676fce50f4 |
Hashes for postgresql_wheel-14.1.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7733e0272c36c2532ca37ec3bb07a9a153f77c5fa8445ed506f1e40d6ac6d6c |
|
MD5 | b828e45b5de129bc0c4d9137a168fbf0 |
|
BLAKE2b-256 | 9ddbc1017847e0236b75c1954e7a26e93d19f73b64f2aaf192f78243e2d3c60f |
Hashes for postgresql_wheel-14.1.1-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06c28f2078f9a3b4c433a6df49aa76053ffba3e8564827f857827e054db7cb56 |
|
MD5 | 684cf663f1b2889a8134708ceeba7798 |
|
BLAKE2b-256 | f7ea88410fe08645c8cd17147859e8ff3ecd5116dfaf7deb1e845e3c8f46b8af |
Hashes for postgresql_wheel-14.1.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e3f5db9fc441857105d0270d339914d19e0b1e482daaa5451f373c1102f1497 |
|
MD5 | 275d43fdf7b9e18bf6ac024b520be17c |
|
BLAKE2b-256 | 277740721827ee70beed453b0b2b86a41408b716b7d9fe52a21334f2436bddc8 |
Hashes for postgresql_wheel-14.1.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1327f8dcf7c44b23e9338904cbefd0113488980ef96c61f79cc1ee8cefe35c5 |
|
MD5 | 6b9d465031c30836407b243cd08914c2 |
|
BLAKE2b-256 | 3b6f247faa857ecafbb19f4f0a834cdf14959d5b28614256ea7c6b94a1b62c08 |
Hashes for postgresql_wheel-14.1.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98f2ea1f5342c8ebea058c009678b6089f3fb34d8787319d3277295236a8a5c9 |
|
MD5 | b0a77116ca7889f213127581c3deca1c |
|
BLAKE2b-256 | f5b404f086603d209da7f1461eaa8e402f5355d7a447290fd18e57476cfd8ad9 |
Hashes for postgresql_wheel-14.1.1-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e2581bb9478c5a9bc6c59a0082ba9f04b94da1892fc7e81908c4e634411c522 |
|
MD5 | 6c2bcc64c4ffde5ac993f0660058698c |
|
BLAKE2b-256 | 20e4537c009e1b5ab482ebe38834c8180beb2d44233e2d8ae49b1a1a72e2ddfe |
Hashes for postgresql_wheel-14.1.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62145469e2480c1978cfd05c5322b3018e2cd15fa85a711bd1dfa75a47d3029f |
|
MD5 | 02e81aadbc9ff8682e7898141f68f60e |
|
BLAKE2b-256 | 8b08ac87a6ca41d5f33cfff838ea1581f8782445678dc107d426f162b2958bbc |
Hashes for postgresql_wheel-14.1.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee2757ec0e785e7003a53e4751d4cbbef1f5dc0b0b255d7388b0057a6498badc |
|
MD5 | dfaf70ef4877d8c9492eaa27b52f5c19 |
|
BLAKE2b-256 | 98d45205c94b2a4c2c0feed57343e8c9048cdcea3b83f2be2c982ddf2703a85a |
Hashes for postgresql_wheel-14.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8ad44dabca3ebb92cb62d936026efd1e992041df9249326d212a921de9b2cbe |
|
MD5 | 30e5ea5400ffc5a3f2aa1819bfb48dba |
|
BLAKE2b-256 | 419f53495f66d6d7d08cd41ce598ecaf2bce73f27b57d96df0964397dab5ea61 |
Hashes for postgresql_wheel-14.1.1-cp37-cp37m-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e19144de0ff87311da19cf0e926713d8f3ab6809a8c9c24bfeb508d3edd028bd |
|
MD5 | f977db80c5aff87339601a811260bd0e |
|
BLAKE2b-256 | 1f31ec84439c65be682324ed478849856b07b61a0625c3ed69b841b9c115f342 |
Hashes for postgresql_wheel-14.1.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b33e6a9af9d9ae393a1da0565665716aadce18228027516090edf64298a6d33 |
|
MD5 | 1e580b13f6f9db5b40f414772a1c3538 |
|
BLAKE2b-256 | fc21eef00fb28754fba7bedd636c6aa27912271ee6bb6dfb146ef3c09d1582a7 |
Hashes for postgresql_wheel-14.1.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b49905db79f8a253885ccc195b3739919a1c569b8593bd0c53f429b81319a9c |
|
MD5 | 0a1c3eec97e983a2e2d3d12b27859a1b |
|
BLAKE2b-256 | baddbebcb9dddcffbbcdb3ae7327b32e2454fcb4b11b8744d812da5613bafbbe |