diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-02-12 19:06:49 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-02-12 19:06:49 -0500 |
commit | c6278444aa58f74c9373823b8dc4eebc6a21b2f1 (patch) | |
tree | 79873beb6cbcb121028267016e55c9f72ca5f976 /lib/sqlalchemy/dialects/postgresql/psycopg2.py | |
parent | 87a06688bc29d26f8e4e695b99767b3627b12ee5 (diff) | |
download | sqlalchemy-c6278444aa58f74c9373823b8dc4eebc6a21b2f1.tar.gz |
- break out sample URLs into individual, per-database sections each with a link
to the dialect page.
- add a section for unix domain sockets under psycopg2 [ticket:2393]
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/psycopg2.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py index 47c9e2232..5aa93978b 100644 --- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py +++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py @@ -38,6 +38,26 @@ psycopg2-specific keyword arguments which are accepted by * *use_native_unicode* - Enable the usage of Psycopg2 "native unicode" mode per connection. True by default. +Unix Domain Connections +------------------------ + +psycopg2 supports connecting via Unix domain connections. When the ``host`` +portion of the URL is omitted, SQLAlchemy passes ``None`` to psycopg2, +which specifies Unix-domain communication rather than TCP/IP communication:: + + create_engine("postgresql+psycopg2://user:password@/dbname") + +By default, the socket file used is to connect to a Unix-domain socket +in ``/tmp``, or whatever socket directory was specified when PostgreSQL +was built. This value can be overridden by passing a pathname to psycopg2, +using ``host`` as an additional keyword argument:: + + create_engine("postgresql+psycopg2://user:password@/dbname?host=/var/lib/postgresql") + +See also: + +`PQconnectdbParams <http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-PQCONNECTDBPARAMS>`_ + Per-Statement/Connection Execution Options ------------------------------------------- |