GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sqlobject/py-postgresql: py-postgresql: Access a PostgreSQL database with Python 3

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

887 Commits
887 Commits

Folders and files

NameName
Last commit message
Last commit date
postgresql
postgresql
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
AUTHORS
AUTHORS
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
pyproject.toml
pyproject.toml
 
 
readthedocs.yml
readthedocs.yml
 
 
setup.py
setup.py
 
 

Repository files navigation

About

py-postgresql is a Python 3 package providing modules for working with PostgreSQL. Primarily, a high-level driver for querying databases.

While py-postgresql is still usable for many purposes, asyncpg and PostgREST are likely more suitable for most applications:

  • https://github.com/MagicStack/asyncpg
  • https://postgrest.org

py-postgresql, currently, does not have direct support for high-level async interfaces provided by recent versions of Python. Future versions may change this.

  • Project Future

Advisory

In v2.0, many, potentially breaking, changes are planned. If you have automated installations using PyPI, make sure that they specify a major version.

  • Support for older versions of PostgreSQL and Python will be removed. This will allow the driver to defer version parsing fixing (python-postgres#109), and better prepare for future versions.
  • The connection establishment strategy will be simplified to only performing one attempt. sslmode parameter should be considered deprecated. v1.4 will provide a new security parameter implying sslmode=require. See (python-postgres#122) and (python-postgres#75).
  • StoredProcedure will be removed. See (python-postgres#80).

Installation

From PyPI using pip:

python3 -m pip install py-postgresql

From GitHub using a full clone:

git clone https://github.com/python-postgres/fe.git
cd fe
python3 ./setup.py install

Basic Usage

import postgresql
db = postgresql.open('pq://user:password@host:port/database')

get_table = db.prepare("SELECT * from information_schema.tables WHERE table_name = $1")
print(get_table("tables"))

# Streaming, in a transaction.
with db.xact():
	for x in get_table.rows("tables"):
		print(x)

REPL with connection bound to db builtin:

python3 -m postgresql.bin.pg_python -I 'pq://postgres@localhost:5423/postgres'

Documentation

  • https://py-postgresql.readthedocs.io
  • https://github.com/python-postgres/fe/issues?q=label%3Ahowto

Related

  • https://postgresql.org
  • https://python.org

About

py-postgresql: Access a PostgreSQL database with Python 3

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.