CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Wed, 03 Sep 2025 06:50:19 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20091209083829
location: https://web.archive.org/web/20091209083829/https://python.projects.postgresql.org/
server-timing: captures_list;dur=0.646472, exclusion.robots;dur=0.021353, exclusion.robots.policy;dur=0.010978, esindex;dur=0.015415, cdx.remote;dur=15.102092, LoadShardBlock;dur=575.268082, PetaboxLoader3.datanode;dur=67.562971
x-app-server: wwwb-app220
x-ts: 302
x-tr: 618
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app220; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Wed, 03 Sep 2025 06:50:20 GMT
content-type: text/html
x-archive-orig-date: Wed, 09 Dec 2009 08:38:28 GMT
x-archive-orig-server: Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2 PHP/4.4.9 with Suhosin-Patch
x-archive-orig-last-modified: Wed, 12 Aug 2009 14:56:34 GMT
x-archive-orig-etag: "f46130-53b0-470f3066ccc80"
x-archive-orig-accept-ranges: bytes
x-archive-orig-content-length: 21424
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Wed, 09 Dec 2009 08:38:29 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Tue, 24 May 2005 20:03:22 GMT", ; rel="prev memento"; datetime="Sat, 19 Sep 2009 04:24:01 GMT", ; rel="memento"; datetime="Wed, 09 Dec 2009 08:38:29 GMT", ; rel="next memento"; datetime="Sun, 10 Jan 2010 09:08:02 GMT", ; rel="last memento"; datetime="Thu, 14 Mar 2019 03:46:02 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_13_20091209023345_crawl100-c/51_13_20091209083521_crawl103.arc.gz
server-timing: captures_list;dur=0.520330, exclusion.robots;dur=0.019424, exclusion.robots.policy;dur=0.008553, esindex;dur=0.011407, cdx.remote;dur=6.174177, LoadShardBlock;dur=276.603919, PetaboxLoader3.datanode;dur=132.689871, PetaboxLoader3.resolve;dur=162.835706, load_resource;dur=165.673532
x-app-server: wwwb-app220
x-ts: 200
x-tr: 492
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
py-postgresql
↑ P(119): b'P\x00\x00\x00v\x00DECLARE "py:0x1191c10" INSENSITIVE SCROLL CURSOR WITH HOLD FOR select i from generate_series(0,100000) as g(i)\x00\x00\x00' ↑ B(13): b'B\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00' ↑ E(10): b'E\x00\x00\x00\t\x00\x00\x00\x00\x01' ↑ S(5): b'S\x00\x00\x00\x04' ↓ b'1'(0): b'' ↓ b'2'(0): b'' ↓ b'C'(15): b'DECLARE CURSOR\x00' ↓ b'Z'(1): b'I' ↑ P(43): b'P\x00\x00\x00*\x00FETCH FORWARD 10 IN "py:0x1191c10"\x00\x00\x00' ↑ B(15): b'B\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01' ↑ E(10): b'E\x00\x00\x00\t\x00\xff\xff\xff\xff' ↑ S(5): b'S\x00\x00\x00\x04' ↓ b'1'(0): b'' ↓ b'2'(0): b'' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x00' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x01' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x02' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x03' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x04' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x05' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x06' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x07' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\x08' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x00\x00\t' ↓ b'C'(9): b'FETCH 10\x00' ↓ b'Z'(1): b'I' ↑ P(37): b'P\x00\x00\x00$\x00MOVE LAST IN "py:0x1191c10"\x00\x00\x00' ↑ B(13): b'B\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00' ↑ E(10): b'E\x00\x00\x00\t\x00\x00\x00\x00\x01' ↑ P(37): b'P\x00\x00\x00$\x00MOVE NEXT IN "py:0x1191c10"\x00\x00\x00' ↑ B(13): b'B\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00' ↑ E(10): b'E\x00\x00\x00\t\x00\x00\x00\x00\x01' ↑ P(42): b'P\x00\x00\x00)\x00MOVE BACKWARD 0 IN "py:0x1191c10"\x00\x00\x00' ↑ B(13): b'B\x00\x00\x00\x0c\x00\x00\x00\x00\x00\x00\x00\x00' ↑ E(10): b'E\x00\x00\x00\t\x00\x00\x00\x00\x01' ↑ S(5): b'S\x00\x00\x00\x04' ↓ b'1'(0): b'' ↓ b'2'(0): b'' ↓ b'C'(7): b'MOVE 1\x00' ↓ b'1'(0): b'' ↓ b'2'(0): b'' ↓ b'C'(7): b'MOVE 0\x00' ↓ b'1'(0): b'' ↓ b'2'(0): b'' ↓ b'C'(7): b'MOVE 0\x00' ↓ b'Z'(1): b'I' ↑ P(44): b'P\x00\x00\x00+\x00FETCH BACKWARD 10 IN "py:0x1191c10"\x00\x00\x00' ↑ B(15): b'B\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x01\x00\x01' ↑ E(10): b'E\x00\x00\x00\t\x00\xff\xff\xff\xff' ↑ S(5): b'S\x00\x00\x00\x04' ↓ b'1'(0): b'' ↓ b'2'(0): b'' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\xa0' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x9f' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x9e' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x9d' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x9c' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x9b' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x9a' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x99' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x98' ↓ b'D'(10): b'\x00\x01\x00\x00\x00\x04\x00\x01\x86\x97' ↓ b'C'(9): b'FETCH 10\x00' ↓ b'Z'(1): b'I' ↑ C(19): b'C\x00\x00\x00\x12Ppy:0x1191c10\x00' ↑ S(5): b'S\x00\x00\x00\x04' ↓ b'3'(0): b'' ↓ b'Z'(1): b'I' ↑ X(5): b'X\x00\x00\x00\x04'

Releases
v0.9 |
|
![]() |
|

Connect
PG-API:
>>> import postgresql >>> db = postgresql.open(user = 'usename', database = 'datname', port = 5432)Or, if DB-API 2.0 is the target:
>>> import postgresql.driver.dbapi20 as dbapi >>> db = dbapi.connect(user = 'usename', database = 'datname', port = 5432, password = 'secret')The Driver documentation has more information on acceptable keyword arguments.

COPY
COPY "FROM STDIN" and "TO STDOUT" is directly supported using the chunking
interfaces. This is allows for connection-to-connection copies:
>>> send = src.prepare("COPY a_table TO STDOUT") >>> recv = dst.prepare("COPY a_table FROM STDIN") >>> recv.load_chunks(send.chunks())

Syntax Errors
py-postgresql's driver provides additional "element tracebacks" along with
the printed exception. This gives significant contextual information that
may help reduce debugging time:
>>> prepare('select 1\nfrom 1d') Traceback (most recent call last): File "<console>", line 1, in <module> File "postgresql/driver/pq3.py", line 1718, in prepare ps._fini() File "postgresql/driver/pq3.py", line 857, in _fini self.database._pq_complete() File "postgresql/driver/pq3.py", line 1973, in _pq_complete self._raise_pq_error(x) File "postgresql/driver/pq3.py", line 1999, in _raise_pq_error raise err postgresql.exceptions.SyntaxError: syntax error at or near "1" CODE: 42601 LOCATION: File 'scan.l', line 807, in base_yyerror from SERVER POSITION: 15 STATEMENT: [parsing] LINE: from 1d ^ [line 2, character 6] statement_id: py:0x10fbc08 string: select 1 from 1d CONNECTION: [idle] client_address: ::1 client_port: 52915 version: PostgreSQL 8.3.6 on i386-apple-darwin, compiled by GCC i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370) CONNECTOR: [Host] pq://jwp:***@localhost:5432 category: None DRIVER: postgresql.driver.pq3.Driver

Composites
Composites are supported:
>>> db.execute('CREATE TYPE ctyp AS (i int, t text, ts timestamp);') >>> r = db.prepare("select (901, 'string', now())::ctyp").first() >>> str(r) "(901, 'string', datetime.datetime(2009, 5, 12, 20, 23, 30, 351411))" >>> r[0] 901 >>> r['i'] 901 >>> r['ts'] datetime.datetime(2009, 5, 12, 20, 23, 30, 351411)

Credits
Copy of the latest authors file:
Primary Developers: James William Pye <x@jwp.name> Contributors: William Grzybowski [subjective paramstyle] Further Credits =============== When licenses match, people win. Code is occasionally imported from other projects to enhance py-postgresql and to allow users to enjoy dependency free installation. DB-API 2.0 Test Case -------------------- postgresql/test/test_dbapi20.py: Stuart Bishop <zen@shangri-la.dropbear.id.au> fcrypt ------ postgresql/resolved/crypt.py: Carey Evans <careye@spamcop.net>
![]() |
py-postgresql
connect to PostgreSQL with Python 3
|
![]() |
py-postgresql provides a driver, cluster management tools, client development tools, and API specifications.