summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/psycopg2.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-05-08 15:19:23 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-05-08 15:19:23 -0400
commit54820b2a64be35d79c927ce231986b0b1236f961 (patch)
tree18a6fa4b0038c0f1e6d9e419fcdc9a037b762e8d /lib/sqlalchemy/dialects/postgresql/psycopg2.py
parent0934e217f82f11873d12dd7b4d1a3e2c336682c7 (diff)
downloadsqlalchemy-54820b2a64be35d79c927ce231986b0b1236f961.tar.gz
add a note about native unicode mode, [ticket:1792]
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
index 6ae6c6c08..ce000ae1b 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -9,6 +9,11 @@ with this module.
Note that psycopg1 is **not** supported.
+Unicode
+-------
+
+By default, the Psycopg2 driver uses the ``psycopg2.extensions.UNICODE`` extension, such that the DBAPI receives and returns all strings as Python Unicode objects directly - SQLAlchemy passes these values through without change. Note that this setting requires that the PG client encoding be set to one which can accomodate the kind of character data being passed - typically ``utf-8``. If the Postgresql database is configured for ``SQL_ASCII`` encoding, which is often the default for PG installations, it may be necessary for non-ascii strings to be encoded into a specific encoding before being passed to the DBAPI. If changing the database's client encoding setting is not an option, specify ``use_native_unicode=False`` as a keyword argument to ``create_engine()``, and take note of the ``encoding`` setting as well, which also defaults to ``utf-8``. Note that disabling "native unicode" mode has a slight performance penalty, as SQLAlchemy now must translate unicode strings to/from an encoding such as utf-8, a task that is handled more efficiently within the Psycopg2 driver natively.
+
Connecting
----------