diff options
Diffstat (limited to 'doc/src')
| -rw-r--r-- | doc/src/cursor.rst | 5 | ||||
| -rw-r--r-- | doc/src/sql.rst | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/src/cursor.rst b/doc/src/cursor.rst index c03cea8..417ab6c 100644 --- a/doc/src/cursor.rst +++ b/doc/src/cursor.rst @@ -601,7 +601,10 @@ The ``cursor`` class The *sql* statement should be in the form :samp:`COPY {table} TO STDOUT` to export :samp:`{table}` to the *file* object passed as argument or :samp:`COPY {table} FROM STDIN` to import the content of - the *file* object into :samp:`{table}`. + the *file* object into :samp:`{table}`. If you need to compose a + :sql:`COPY` statement dynamically (because table, fields, or query + parameters are in Python variables) you may use the objects provided + by the `psycopg2.sql` module. *file* must be a readable file-like object (as required by `~cursor.copy_from()`) for *sql* statement :sql:`COPY ... FROM STDIN` diff --git a/doc/src/sql.rst b/doc/src/sql.rst index 0aee451..fe807c6 100644 --- a/doc/src/sql.rst +++ b/doc/src/sql.rst @@ -55,6 +55,11 @@ from the query parameters:: .format(sql.Identifier('my_table')), [10, 20]) +The objects exposed by the `!sql` module can be used to compose a query as a +Python string (using the `~Composable.as_string()` method) or passed directly +to cursor methods such as `~cursor.execute()`, `~cursor.executemany()`, +`~cursor.copy_expert()`. + .. autoclass:: Composable |
