PostgreSQL 服务器编译成 Python Wheel。
项目描述
postgresql 轮
一个用于 Linux 的 Python 轮,包含一个完整的、独立的、可本地安装的 PostgreSQL 数据库服务器。
所有服务器在本地路径中以 Python 进程用户身份运行,因此此轮不需要 root 或 sudo 权限。数据库可以在任何目录中初始化。
可以在测试夹具中设置和拆除服务器,而无需额外的外部依赖。
目前这个轮子只适用于大多数版本的 Linux。
Postgres 使用Github Actions在cibuildwheel 工具提供的相同“manylinux”环境中编译, 并直接归档到轮子的“package_data”中。
轮子可以用pip安装:
$ pip install postgresql-wheel
postgresql.pg_bin
包中的 Postgres 二进制文件可以在全局变量指向的目录中找到。为方便起见,提供了所有 postgres 二进制程序的函数包装器,如initdb
和pg_ctl
函数:
>>> 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')
为了测试的目的,提供了方便的函数来建立和拆除数据库:
>>> pgdata, con_str = postgresql.setup()
>>> postgresql.psql(f'-h {con_str} -c "select version()"')
>>> postgresql.teardown(pgdata)
还有一个称为 pytest 固定装置tmp_postgres
,它将一个新的连接字符串返回到一个临时数据库本地域套接字,并且可以在 pytest 中使用:
>>> from postgresql import tmp_postgres
>>> def test_foo(tmp_postgres):
... postgresql.psql(f'-h {tmp_postgres} -c "select version()"')
项目详情
关
postgresql_wheel-14.1.2-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl 的哈希 值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 35183a3e8a01b0efe11018efe283c9877c0599813949e7a784db07e37961d6de |
|
MD5 | 374cfe7d2658dd0e1cc23d7266ae61f2 |
|
布莱克2-256 | 3f5dd71c7662ae6d93c2e58f964ca3111fb9454663b34aaa155bf80be3d50d08 |
关
postgresql_wheel-14.1.2-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl 的哈希 值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f54826490b27528d8f63f8b124323e4d07d7071a2253027cc3d379276c8fc490 |
|
MD5 | ac550289189ccabb27d4c1aa5883f9c9 |
|
布莱克2-256 | 4839609512ca6885f6f3f85bb3f95e15f18df76de80226db0ad201f65056eed9 |
关
postgresql_wheel-14.1.2- pp37 -pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | fb1822be9eca6226eb1bc67842303ef88d35cac58d4995d908af7804f8962943 |
|
MD5 | a4d9eb0fb607d2078e07204b48eb6272 |
|
布莱克2-256 | 99cd1aab62a469773165d7bd525f1c754ceaf0c8b95c7180791b882100ad2845 |
关
postgresql_wheel-14.1.2- pp37 -pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b95b030a67603f415ccb0116229b76e7df094e5aa3e2eff03449ef0e1389e942 |
|
MD5 | 822148f7b03abe72e58f4e2c751f2178 |
|
布莱克2-256 | ba5fbac4207576f13617c944c357846cca2b07386bae226daf715131c04511c6 |
关
postgresql_wheel-14.1.2- cp39 -cp39-musllinux_1_1_x86_64.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 91ae68f67c40f6fa1b7d9ab65df5b8461737f98a3a5d078b36bd9ac6d1505914 |
|
MD5 | 79f68eec4210c08896c819fbe7b70272 |
|
布莱克2-256 | 7df8ea57c5e82af39433d37ceffee4a61b681ab5853647637c418c2db5221f00 |
关
postgresql_wheel-14.1.2- cp39 -cp39-musllinux_1_1_i686.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 3b2b560449594fad3ea5df4e75919a6f21f8e241269de2bec06cdb9f17f7532e |
|
MD5 | 270b4b743b5c9e56788f2a538bc8acb9 |
|
布莱克2-256 | 3752bacb3646cd2fc1297758dfa59c44cba46b49fb9614fc9a750dd336b0af0f |
关
postgresql_wheel-14.1.2- cp39 -cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 50b9158acf1c6237344cb1ab5e9689361a543b92d23b4dcd0becf3ad76f79afc |
|
MD5 | e294415a5c96475fc2fc9c035abf73d3 |
|
布莱克2-256 | bbb4ef65e6cf81211ee2b39a09998a3a0929e9edd5ba46cbb034182f84115c0e |
关
postgresql_wheel-14.1.2- cp39 -cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 73735b37e955dc6a55c7f7776e2b6b553362e5d5a27f18bfcaf224ff01c1bafc |
|
MD5 | b8f3d71fe139d02e311b19df8a78190d |
|
布莱克2-256 | e553cdd131a5bf32b5e40cfddc4297eeaf3b54ccfc964f113efaef3a26e74f28 |
关
postgresql_wheel-14.1.2- cp38 -cp38-musllinux_1_1_x86_64.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a9ad8330176ef61a3fe02f1f24885039bc1882298b7a3ac4978e69a431463be8 |
|
MD5 | d83fab3c500b09c37e9beec4f5e28f7a |
|
布莱克2-256 | 24b3e9ddf48536037a798121f7d7e7998fec3b2819a068b88e6394c7da5c5e07 |