From c6278444aa58f74c9373823b8dc4eebc6a21b2f1 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 12 Feb 2012 19:06:49 -0500 Subject: - 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] --- lib/sqlalchemy/dialects/postgresql/psycopg2.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2.py') 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 `_ + Per-Statement/Connection Execution Options ------------------------------------------- -- cgit v1.2.1