pydoc > pg

📘 NAME

pg - PyGreSQL classic interface.

🚀 Quick Reference

Use CaseCommandDescription
Connect to databaseDB(dbname, host, port, opt)Create a new connection to a PostgreSQL database.
Execute a querydb.query(command)Execute a SQL command string.
Insert a rowdb.insert(table, row)Insert a row into a database table.
Update a rowdb.update(table, row)Update an existing row in a database table.
Delete a rowdb.delete(table, row)Delete an existing row in a database table.
Begin transactiondb.begin()Begin a transaction.
Commit transactiondb.commit()Commit the current transaction.
Rollback transactiondb.rollback()Roll back the current transaction.
Get a single rowdb.get(table, row)Get a row from a database table or view.
Get table as listdb.get_as_list(table)Get a table as a list of named tuples.
Get table as dictdb.get_as_dict(table)Get a table as a dictionary.
Escape a stringescape_string(string)Escape a string for use within SQL.

📖 DESCRIPTION

This pg module implements some basic database management stuff. It includes the _pg module and builds on it, providing the higher level wrapper class named DB with additional functionality. This is known as the "classic" ("old style") PyGreSQL interface. For a DB-API 2 compliant interface use the newer pgdb module.

📚 CLASSES

🔧 class Adapter

Adapter(db)

Class providing methods for adapting parameters to the database.

Methods defined here:

Class methods defined here:

Static methods defined here:

Data descriptors defined here:

🔧 class Bytea

Wrapper class for marking Bytea values.

Method resolution order: Bytea, builtins.bytes, builtins.object

Data descriptors defined here:

Methods inherited from builtins.bytes:

Class methods inherited from builtins.bytes:

Static methods inherited from builtins.bytes:

🔧 class DB

DB(*args, **kw)

Wrapper class for the _pg connection type.

Methods defined here:

Static methods defined here:

Data descriptors defined here:

Data and other attributes defined here:

🔧 class DataError

Inherits from DatabaseError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class DatabaseError

Inherits from Error. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class Error

Inherits from builtins.Exception. Standard exception class with __weakref__ data descriptor.

🔧 class Hstore

Wrapper class for marking hstore values.

Methods defined here:

Data descriptors defined here:

Methods inherited from builtins.dict:

Class methods inherited from builtins.dict:

Data and other attributes inherited from builtins.dict:

🔧 class IntegrityError

Inherits from DatabaseError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class InterfaceError

Inherits from Error. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class InternalError

Inherits from DatabaseError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class InvalidResultError

Inherits from DataError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class Json

Json(obj)

Wrapper class for marking Json values.

Methods defined here:

Data descriptors defined here:

🔧 class Literal

Wrapper class for marking literal SQL values.

Data descriptors defined here:

Methods inherited from builtins.str:

Static methods inherited from builtins.str:

🔧 class MultipleResultsError

Inherits from InvalidResultError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class NoResultError

Inherits from InvalidResultError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class NotSupportedError

Inherits from DatabaseError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class NotificationHandler

NotificationHandler(db, event, callback=None, arg_dict=None, timeout=None, stop_event=None)

A PostgreSQL client-side asynchronous notification handler.

Methods defined here:

Data descriptors defined here:

🔧 class OperationalError

Inherits from DatabaseError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class ProgrammingError

Inherits from DatabaseError. Standard exception class with no additional methods beyond those inherited from builtins.Exception and builtins.BaseException.

🔧 class Typecasts

Dictionary mapping database types to typecast functions.

Methods defined here:

Class methods defined here:

Data descriptors defined here:

Data and other attributes defined here:

Methods inherited from builtins.dict:

🔧 class Warning

Inherits from builtins.Exception. Standard exception class with __weakref__ data descriptor.

🔧 FUNCTIONS

📊 DATA

📦 VERSION

5.1.2

📁 FILE

/usr/lib/python3/dist-packages/pg.py

pg
📘 NAME 🚀 Quick Reference 📖 DESCRIPTION 📚 CLASSES 🔧 FUNCTIONS 📊 DATA 📦 VERSION 📁 FILE

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 16:48 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^