diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-02-09 16:30:52 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2010-02-14 00:39:47 +0100 |
| commit | ac6640fd9e03b89700fe3351a268260dfc42fd3b (patch) | |
| tree | 1eeec72434f3e32e93e7a59ea3d52ddc0264a850 /doc/usage.rst | |
| parent | d081d533b968b42d16f3bdc480d06fbe9a2ff002 (diff) | |
| download | psycopg2-ac6640fd9e03b89700fe3351a268260dfc42fd3b.tar.gz | |
Completed documentation for the COPY-related methods.
Diffstat (limited to 'doc/usage.rst')
| -rw-r--r-- | doc/usage.rst | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/doc/usage.rst b/doc/usage.rst index 044c93a..29c5b67 100644 --- a/doc/usage.rst +++ b/doc/usage.rst @@ -339,19 +339,26 @@ Using COPY TO and COPY FROM --------------------------- Psycopg :class:`cursor` objects provide an interface to the efficient -PostgreSQL `COPY command`_ to move data from files to tables and back. +PostgreSQL |COPY|__ command to move data from files to tables and back. +The methods exposed are: -The :meth:`cursor.copy_to()` method writes the content of a table *to* a -file-like object. The target file must have a ``write()`` method. +:meth:`cursor.copy_to()` + Writes the content of a table *to* a file-like object (``COPY table TO + file`` syntax). The target file must have a ``write()`` method. -The :meth:`cursor.copy_from()` reads data *from* a file-like object appending -them to a database table. The source file must have both ``read()`` and -``readline()`` method. +:meth:`cursor.copy_from()` + Reads data *from* a file-like object appending them to a database table + (``COPY table FROM file`` syntax). The source file must have both + ``read()`` and ``readline()`` method. -Both methods accept two optional arguments: ``sep`` (defaulting to a tab) is -the columns separator and ``null`` (defaulting to ``\N``) represents ``NULL`` -values in the file. +:meth:`cursor.copy_expert()` + Allows to handle more specific cases and to use all the |COPY| features + available in PostgreSQL. -.. _COPY command: http://www.postgresql.org/docs/8.4/static/sql-copy.html +Please refer to the documentation of the single methods for details and +examples. + +.. |COPY| replace:: ``COPY`` +.. __: http://www.postgresql.org/docs/8.4/static/sql-copy.html |
