Package psycopg2 :: Module _psycopg :: Class connection
[show private | hide private]
[frames | no frames]

Type connection

object --+
         |
        connection

Known Subclasses:
connection, DictConnection

connection(dsn, ...) -> new connection object


Method Summary
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __repr__(x)
Return repr(x)...
  __str__(x)
Return str(x)...
  close()
Close the connection.
  commit()
Commit all changes to database.
extensions.cursor cursor(cursor_factory)
new cursor
  rollback()
Roll back all changes done to database.
  set_client_encoding(encoding)
Set client encoding to encoding.
  set_isolation_level(level)
Switch isolation level to level.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Property Summary
  closed: True if the connection is closed.
  dsn: The current connection string.
  encoding: The current client encoding.
  isolation_level: The current isolation level.
  notices
  notifies
    DBAPI-2.0 errors
  Error: Base class for error exceptions.
  Warning: A database warning.
  InterfaceError: Error related to the database interface.
  DatabaseError: Error related to the database engine.
  InternalError: The database encountered an internal error.
  OperationalError: Error related to database operation (disconnect, memory allocation etc).
  ProgrammingError: Error related to database programming (SQL error, table not found etc).
  IntegrityError: Error related to database integrity.
  DataError: Error related to problems with the processed data.
  NotSupportedError: A not supported datbase API was called.

Method Details

__init__(...)
(Constructor)

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides:
__builtin__.object.__init__

__new__(T, S, ...)

Returns:
a new object with type S, a subtype of T
Overrides:
__builtin__.object.__new__

__repr__(x)
(Representation operator)

Returns:
repr(x)
Overrides:
__builtin__.object.__repr__

__str__(x)
(Informal representation operator)

Returns:
str(x)
Overrides:
__builtin__.object.__str__

close()

Close the connection.

commit()

Commit all changes to database.

cursor(cursor_factory=extensions.cursor)

new cursor

Return a new cursor.

The cursor_factory argument can be used to create non-standard cursors by passing a class different from the default. Note that the new class should be a sub-class of extensions.cursor.

Returns:
extensions.cursor

rollback()

Roll back all changes done to database.

set_client_encoding(encoding)

Set client encoding to encoding.

set_isolation_level(level)

Switch isolation level to level.


Property Details

Error

Base class for error exceptions.

Warning

A database warning.

InterfaceError

Error related to the database interface.

DatabaseError

Error related to the database engine.

InternalError

The database encountered an internal error.

OperationalError

Error related to database operation (disconnect, memory allocation etc).

ProgrammingError

Error related to database programming (SQL error, table not found etc).

IntegrityError

Error related to database integrity.

DataError

Error related to problems with the processed data.

NotSupportedError

A not supported datbase API was called.

closed

True if the connection is closed.

dsn

The current connection string.

encoding

The current client encoding.

isolation_level

The current isolation level.