diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/advanced.rst | 2 | ||||
-rw-r--r-- | doc/src/conf.py | 4 | ||||
-rw-r--r-- | doc/src/connection.rst | 23 | ||||
-rw-r--r-- | doc/src/cursor.rst | 5 | ||||
-rw-r--r-- | doc/src/install.rst | 24 | ||||
-rw-r--r-- | doc/src/usage.rst | 10 |
6 files changed, 60 insertions, 8 deletions
diff --git a/doc/src/advanced.rst b/doc/src/advanced.rst index e63fcff..f2e279f 100644 --- a/doc/src/advanced.rst +++ b/doc/src/advanced.rst @@ -47,7 +47,7 @@ it is the class where query building, execution and result type-casting into Python variables happens. The `~psycopg2.extras` module contains several examples of :ref:`connection -and cursor sublcasses <cursor-subclasses>`. +and cursor subclasses <cursor-subclasses>`. .. note:: diff --git a/doc/src/conf.py b/doc/src/conf.py index 18b81e0..94ffa34 100644 --- a/doc/src/conf.py +++ b/doc/src/conf.py @@ -42,9 +42,7 @@ master_doc = 'index' # General information about the project. project = u'Psycopg' -from datetime import date -year = date.today().year -copyright = u'2001-%s, Federico Di Gregorio, Daniele Varrazzo' % year +copyright = u'2001-2016, Federico Di Gregorio, Daniele Varrazzo' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff --git a/doc/src/connection.rst b/doc/src/connection.rst index cceef1e..c99c8bd 100644 --- a/doc/src/connection.rst +++ b/doc/src/connection.rst @@ -569,6 +569,29 @@ The ``connection`` class .. index:: + pair: Connection; Parameters + + .. method:: get_dsn_parameters() + + Get the effective dsn parameters for the connection as a dictionary. + + The *password* parameter is removed from the result. + + Example:: + + >>> conn.get_dsn_parameters() + {'dbname': 'test', 'user': 'postgres', 'port': '5432', 'sslmode': 'prefer'} + + Requires libpq >= 9.3. + + .. seealso:: libpq docs for `PQconninfo()`__ for details. + + .. __: http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PQCONNINFO + + .. versionadded:: 2.7 + + + .. index:: pair: Transaction; Status .. method:: get_transaction_status() diff --git a/doc/src/cursor.rst b/doc/src/cursor.rst index 73bb537..45e6278 100644 --- a/doc/src/cursor.rst +++ b/doc/src/cursor.rst @@ -494,6 +494,9 @@ The ``cursor`` class .. rubric:: COPY-related methods + Efficiently copy data from file-like objects to the database and back. See + :ref:`copy` for an overview. + .. extension:: The :sql:`COPY` command is a PostgreSQL extension to the SQL standard. @@ -502,7 +505,7 @@ The ``cursor`` class .. method:: copy_from(file, table, sep='\\t', null='\\\\N', size=8192, columns=None) Read data *from* the file-like object *file* appending them to - the table named *table*. See :ref:`copy` for an overview. + the table named *table*. :param file: file-like object to read data from. It must have both `!read()` and `!readline()` methods. diff --git a/doc/src/install.rst b/doc/src/install.rst index ec1eeea..3a95adc 100644 --- a/doc/src/install.rst +++ b/doc/src/install.rst @@ -18,7 +18,7 @@ The current `!psycopg2` implementation supports: NOTE: keep consistent with setup.py and the /features/ page. - Python 2 versions from 2.5 to 2.7 -- Python 3 versions from 3.1 to 3.4 +- Python 3 versions from 3.1 to 3.5 - PostgreSQL versions from 7.4 to 9.4 .. _PostgreSQL: http://www.postgresql.org/ @@ -51,6 +51,16 @@ extension packages, *above all if you are a Windows or a Mac OS user*, please use a pre-compiled package and go straight to the :ref:`module usage <usage>` avoid bothering with the gory details. +.. note:: + + Regardless of the way `!psycopg2` is installed, at runtime it will need to + use the libpq_ library. `!psycopg2` relies on the host OS to find the + library file (usually ``libpq.so`` or ``libpq.dll``): if the library is + installed in a standard location there is usually no problem; if the + library is in a non-standard location you will have to tell somehow + psycopg how to find it, which is OS-dependent (for instance setting a + suitable :envvar:`LD_LIBRARY_PATH` on Linux). + .. _install-from-package: @@ -95,7 +105,17 @@ Install from a package pair: Install; Windows **Microsoft Windows** - Jason Erickson maintains a packaged `Windows port of Psycopg`__ with + There are two options to install a precompiled `psycopg2` package under windows: + + **Option 1:** Using `pip`__ (Included in python 2.7.9+ and python 3.4+) + and a binary wheel package. Launch windows' command prompt (`cmd.exe`) + and execute the following command:: + + pip install psycopg2 + + .. __: https://pip.pypa.io/en/stable/installing/ + + **Option 2:** Jason Erickson maintains a packaged `Windows port of Psycopg`__ with installation executable. Download. Double click. Done. .. __: http://www.stickpeople.com/projects/python/win-psycopg/ diff --git a/doc/src/usage.rst b/doc/src/usage.rst index 9dd31df..3b42aeb 100644 --- a/doc/src/usage.rst +++ b/doc/src/usage.rst @@ -864,11 +864,19 @@ Using COPY TO and COPY FROM Psycopg `cursor` objects provide an interface to the efficient PostgreSQL |COPY|__ command to move data from files to tables and back. + +Currently no adaptation is provided between Python and PostgreSQL types on +|COPY|: the file can be any Python file-like object but its format must be in +the format accepted by `PostgreSQL COPY command`__ (data fromat, escaped +characters, etc). + +.. __: COPY_ + The methods exposed are: `~cursor.copy_from()` Reads data *from* a file-like object appending them to a database table - (:sql:`COPY table FROM file` syntax). The source file must have both + (:sql:`COPY table FROM file` syntax). The source file must provide both `!read()` and `!readline()` method. `~cursor.copy_to()` |