1 """A Python driver for PostgreSQL
3 psycopg is a PostgreSQL_ database adapter for the Python_ programming
4 language. This is version 2, a complete rewrite of the original code to
5 provide new-style classes for connection and cursor objects and other sweet
6 candies. Like the original, psycopg 2 was written with the aim of being very
7 small and fast, and stable as a rock.
9 Homepage: http://initd.org/projects/psycopg2
11 .. _PostgreSQL: http://www.postgresql.org/
12 .. _Python: http://www.python.org/
15 * `Connections creation`: connect
16 * `Value objects constructors`: Binary, Date, DateFromTicks, Time,
17 TimeFromTicks, Timestamp, TimestampFromTicks
19 # psycopg/__init__.py - initialization of the psycopg module
21 # Copyright (C) 2003-2004 Federico Di Gregorio <fog@debian.org>
23 # This program is free software; you can redistribute it and/or modify
24 # it under the terms of the GNU General Public License as published by the
25 # Free Software Foundation; either version 2, or (at your option) any later
28 # This program is distributed in the hope that it will be useful, but
29 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
30 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
33 # Import modules needed by _psycopg to allow tools like py2exe to do
34 # their work without bothering about the module dependencies.
36 # TODO: we should probably use the Warnings framework to signal a missing
37 # module instead of raising an exception (in case we're running a thin
38 # embedded Python or something even more devious.)
41 if sys.version_info[0] >= 2 and sys.version_info[1] >= 3:
43 import datetime as _psycopg_needs_datetime
46 "can't import datetime module probably needed by _psycopg",
48 if sys.version_info[0] >= 2 and sys.version_info[1] >= 4:
50 import decimal as _psycopg_needs_decimal
53 "can't import decimal module probably needed by _psycopg",
55 from psycopg2 import tz
58 # Import the DBAPI-2.0 stuff into top-level module.
60 from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
62 from _psycopg import Binary, Date, Time, Timestamp
63 from _psycopg import DateFromTicks, TimeFromTicks, TimestampFromTicks
65 from _psycopg import Error, Warning, DataError, DatabaseError, ProgrammingError
66 from _psycopg import IntegrityError, InterfaceError, InternalError
67 from _psycopg import NotSupportedError, OperationalError
69 from _psycopg import connect, apilevel, threadsafety, paramstyle
70 from _psycopg import __version__
72 __all__ = [ k for k in locals().keys() if not k.startswith('_') ]