Package psycopg2
[hide private]
[frames] | no frames]

Package psycopg2

source code

A Python driver for PostgreSQL

psycopg is a PostgreSQL_ database adapter for the Python_ programming
language. This is version 2, a complete rewrite of the original code to
provide new-style classes for connection and cursor objects and other sweet
candies. Like the original, psycopg 2 was written with the aim of being very
small and fast, and stable as a rock.

Homepage: http://initd.org/projects/psycopg2

.. _PostgreSQL: http://www.postgresql.org/
.. _Python: http://www.python.org/

:Groups:
  * `Connections creation`: connect
  * `Value objects constructors`: Binary, Date, DateFromTicks, Time,
    TimeFromTicks, Timestamp, TimestampFromTicks




Version: 2.0.6 (dec mx dt ext pq3)

Submodules [hide private]

Classes [hide private]
  DataError
Error related to problems with the processed data.
  DatabaseError
Error related to the database engine.
  Error
Base class for error exceptions.
  IntegrityError
Error related to database integrity.
  InterfaceError
Error related to the database interface.
  InternalError
The database encountered an internal error.
  NotSupportedError
A not supported datbase API was called.
  OperationalError
Error related to database operation (disconnect, memory allocation etc).
  ProgrammingError
Error related to database programming (SQL error, table not found etc).
  Warning
A database warning.
Functions [hide private]
 
Binary(buffer)
Build an object capable to hold a bynary string value.
 
Date(year, month, day)
Build an object holding a date value.
 
DateFromTicks(ticks)
Build an object holding a date value from the given ticks value.
 
Time(hour, minutes, seconds, tzinfo=None)
Build an object holding a time value.
 
TimeFromTicks(ticks)
Build an object holding a time value from the given ticks value.
 
Timestamp(year, month, day, hour, minutes, seconds, tzinfo=None)
Build an object holding a timestamp value.
 
TimestampFromTicks(ticks)
Build an object holding a timestamp value from the given ticks value.
 
connect(dsn, ...)
Create a new database connection.
Variables [hide private]
  BINARY = <psycopg2._psycopg.type object at 0xe7ab90>
  DATETIME = <psycopg2._psycopg.type object at 0xe7aab0>
  NUMBER = <psycopg2._psycopg.type object at 0xe7a8b8>
  ROWID = <psycopg2._psycopg.type object at 0xe7abc8>
  STRING = <psycopg2._psycopg.type object at 0xe7aa40>
  apilevel = '2.0'
  k = 'DatabaseError'
  paramstyle = 'pyformat'
  threadsafety = <web2py.gluon.custom_import._Web2pyImporter obj...
PyMySQL: A pure-Python drop-in replacement for MySQLdb.
Function Details [hide private]

Binary(buffer)

 
Build an object capable to hold a bynary string value.
Returns:
new binary object

Date(year, month, day)

 
Build an object holding a date value.
Returns:
new date

DateFromTicks(ticks)

 

Build an object holding a date value from the given ticks value.

Ticks are the number of seconds since the epoch; see the documentation of the standard Python time module for details).
Returns:
new date

Time(hour, minutes, seconds, tzinfo=None)

 
Build an object holding a time value.
Returns:
new time

TimeFromTicks(ticks)

 

Build an object holding a time value from the given ticks value.

Ticks are the number of seconds since the epoch; see the documentation of the standard Python time module for details).
Returns:
new time

Timestamp(year, month, day, hour, minutes, seconds, tzinfo=None)

 
Build an object holding a timestamp value.
Returns:
new timestamp

TimestampFromTicks(ticks)

 

Build an object holding a timestamp value from the given ticks value.

Ticks are the number of seconds since the epoch; see the documentation of the standard Python time module for details).
Returns:
new timestamp

connect(dsn, ...)

 
Create a new database connection.

This function supports two different but equivalent sets of arguments.
A single data source name or ``dsn`` string can be used to specify the
connection parameters, as follows::

    psycopg2.connect("dbname=xxx user=xxx ...")

If ``dsn`` is not provided it is possible to pass the parameters as
keyword arguments; e.g.::

    psycopg2.connect(database='xxx', user='xxx', ...)

The full list of available parameters is:

- ``dbname`` -- database name (only in 'dsn')
- ``database`` -- database name (only as keyword argument)
- ``host`` -- host address (defaults to UNIX socket if not provided)
- ``port`` -- port number (defaults to 5432 if not provided)
- ``user`` -- user name used to authenticate
- ``password`` -- password used to authenticate
- ``sslmode`` -- SSL mode (see PostgreSQL documentation)

If the ``connection_factory`` keyword argument is not provided this
function always return an instance of the `connection` class.
Else the given sub-class of `extensions.connection` will be used to
instantiate the connection object.

:return: New database connection
:rtype: `extensions.connection`


Variables Details [hide private]

threadsafety

PyMySQL: A pure-Python drop-in replacement for MySQLdb.

Copyright (c) 2010 PyMySQL contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Value:
global_settings.applications_parent