Package psycopg2 :: Module extensions
[show private | hide private]
[frames | no frames]

Module psycopg2.extensions

psycopg extensions to the DBAPI-2.0

This module holds all the extensions to the DBAPI-2.0 provided by psycopg.


Function Summary
object adapt(obj, protocol, alternate)
adapt obj to given protocol
new AsIs wrapper object AsIs(obj)
new boolean value Boolean(obj)
new wrapper DateFromPy(datetime.date)
new wrapper IntervalFromPy(datetime.timedelta)
new type object new_type(oids, name, adapter)
Create a new binding object.
new quoted string QuotedString(str, enc)
  register_adapter(typ, callable)
Register 'callable' as an ISQLQuote adapter for type 'typ'.
None register_type(obj)
register obj with psycopg type system
new wrapper TimeFromPy(datetime.time)
new wrapper TimestampFromPy(datetime.datetime)

Variable Summary
int ISOLATION_LEVEL_AUTOCOMMIT = 0                                                                     
int ISOLATION_LEVEL_READ_COMMITTED = 1                                                                     
int ISOLATION_LEVEL_READ_UNCOMMITTED = 1                                                                     
int ISOLATION_LEVEL_REPEATABLE_READ = 2                                                                     
int ISOLATION_LEVEL_SERIALIZABLE = 2                                                                     

Function Details

adapt(obj, protocol, alternate)

adapt obj to given protocol

Returns:
object

AsIs(obj)

Returns:
new AsIs wrapper object

Boolean(obj)

Returns:
new boolean value

DateFromPy(datetime.date)

Returns:
new wrapper

IntervalFromPy(datetime.timedelta)

Returns:
new wrapper

new_type(oids, name, adapter)

Create a new binding object. The object can be used with the register_type() function to bind PostgreSQL objects to python objects.

Parameters:
oids - Tuple of oid of the PostgreSQL types to convert.
name - Name for the new type
adapter - Callable to perform type conversion. It must have the signature fun(value, cur) where value is the string representation returned by PostgreSQL (None if NULL) and cur is the cursor from which data are read.
Returns:
new type object

QuotedString(str, enc)

Returns:
new quoted string

register_adapter(typ, callable)

Register 'callable' as an ISQLQuote adapter for type 'typ'.

register_type(obj)

register obj with psycopg type system

Parameters:
obj - A type adapter created by new_type()
Returns:
None

TimeFromPy(datetime.time)

Returns:
new wrapper

TimestampFromPy(datetime.datetime)

Returns:
new wrapper

Variable Details

ISOLATION_LEVEL_AUTOCOMMIT

Type:
int
Value:
0                                                                     

ISOLATION_LEVEL_READ_COMMITTED

Type:
int
Value:
1                                                                     

ISOLATION_LEVEL_READ_UNCOMMITTED

Type:
int
Value:
1                                                                     

ISOLATION_LEVEL_REPEATABLE_READ

Type:
int
Value:
2                                                                     

ISOLATION_LEVEL_SERIALIZABLE

Type:
int
Value:
2