mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
parent
5f3be39e0a
commit
05f23df238
|
@ -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.
|
||||
|
|
|
@ -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()`
|
||||
|
|
Loading…
Reference in New Issue
Block a user