mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
A bunch of typo fixed in the docs
This commit is contained in:
parent
855674faf1
commit
99620c1454
|
@ -149,7 +149,7 @@ column of the `cursor.description`:
|
||||||
>>> point_oid
|
>>> point_oid
|
||||||
600
|
600
|
||||||
|
|
||||||
or by querying the system catalogs for the type name and namespace (the
|
or by querying the system catalog for the type name and namespace (the
|
||||||
namespace for system objects is :sql:`pg_catalog`):
|
namespace for system objects is :sql:`pg_catalog`):
|
||||||
|
|
||||||
>>> cur.execute("""
|
>>> cur.execute("""
|
||||||
|
@ -163,7 +163,7 @@ namespace for system objects is :sql:`pg_catalog`):
|
||||||
>>> point_oid
|
>>> point_oid
|
||||||
600
|
600
|
||||||
|
|
||||||
After you know the object OID, you must can and register the new type:
|
After you know the object OID, you can create and register the new type:
|
||||||
|
|
||||||
>>> POINT = psycopg2.extensions.new_type((point_oid,), "POINT", cast_point)
|
>>> POINT = psycopg2.extensions.new_type((point_oid,), "POINT", cast_point)
|
||||||
>>> psycopg2.extensions.register_type(POINT)
|
>>> psycopg2.extensions.register_type(POINT)
|
||||||
|
|
|
@ -198,6 +198,8 @@ The ``cursor`` class
|
||||||
The following methods are used to read data from the database after an
|
The following methods are used to read data from the database after an
|
||||||
`~cursor.execute()` call.
|
`~cursor.execute()` call.
|
||||||
|
|
||||||
|
.. _cursor-iterable:
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
`cursor` objects are iterable, so, instead of calling
|
`cursor` objects are iterable, so, instead of calling
|
||||||
|
|
|
@ -104,7 +104,7 @@ deal with Python objects adaptation:
|
||||||
|
|
||||||
.. function:: adapt(obj)
|
.. function:: adapt(obj)
|
||||||
|
|
||||||
Return the SQL representation of `obj` as a string. Raise a
|
Return the SQL representation of *obj* as a string. Raise a
|
||||||
`~psycopg2.ProgrammingError` if how to adapt the object is unknown.
|
`~psycopg2.ProgrammingError` if how to adapt the object is unknown.
|
||||||
In order to allow new objects to be adapted, register a new adapter for it
|
In order to allow new objects to be adapted, register a new adapter for it
|
||||||
using the `register_adapter()` function.
|
using the `register_adapter()` function.
|
||||||
|
@ -115,9 +115,9 @@ deal with Python objects adaptation:
|
||||||
|
|
||||||
.. function:: register_adapter(class, adapter)
|
.. function:: register_adapter(class, adapter)
|
||||||
|
|
||||||
Register a new adapter for the objects of class `class`.
|
Register a new adapter for the objects of class *class*.
|
||||||
|
|
||||||
`adapter` should be a function taking a single argument (the object
|
*adapter* should be a function taking a single argument (the object
|
||||||
to adapt) and returning an object conforming the `ISQLQuote`
|
to adapt) and returning an object conforming the `ISQLQuote`
|
||||||
protocol (e.g. exposing a `!getquoted()` method). The `AsIs` is
|
protocol (e.g. exposing a `!getquoted()` method). The `AsIs` is
|
||||||
often useful for this task.
|
often useful for this task.
|
||||||
|
@ -236,19 +236,20 @@ details.
|
||||||
The object OID can be read from the `cursor.description` attribute
|
The object OID can be read from the `cursor.description` attribute
|
||||||
or by querying from the PostgreSQL catalog.
|
or by querying from the PostgreSQL catalog.
|
||||||
|
|
||||||
`adapter` should have signature :samp:`fun({value}, {cur})` where
|
*adapter* should have signature :samp:`fun({value}, {cur})` where
|
||||||
:samp:`{value}` is the string representation returned by PostgreSQL and
|
*value* is the string representation returned by PostgreSQL and
|
||||||
:samp:`{cur}` is the cursor from which data are read. In case of
|
*cur* is the cursor from which data are read. In case of
|
||||||
:sql:`NULL`, :samp:`{value}` is ``None``. The adapter should return the
|
:sql:`NULL`, *value* will be ``None``. The adapter should return the
|
||||||
converted object.
|
converted object.
|
||||||
|
|
||||||
See :ref:`type-casting-from-sql-to-python` for an usage example.
|
See :ref:`type-casting-from-sql-to-python` for an usage example.
|
||||||
|
|
||||||
|
|
||||||
.. function:: register_type(obj [, scope])
|
.. function:: register_type(obj [, scope])
|
||||||
|
|
||||||
Register a type caster created using `new_type()`.
|
Register a type caster created using `new_type()`.
|
||||||
|
|
||||||
If `scope` is specified, it should be a `connection` or a
|
If *scope* is specified, it should be a `connection` or a
|
||||||
`cursor`: the type caster will be effective only limited to the
|
`cursor`: the type caster will be effective only limited to the
|
||||||
specified object. Otherwise it will be globally registered.
|
specified object. Otherwise it will be globally registered.
|
||||||
|
|
||||||
|
@ -330,9 +331,9 @@ set to one of the following constants:
|
||||||
|
|
||||||
.. data:: ISOLATION_LEVEL_READ_UNCOMMITTED
|
.. data:: ISOLATION_LEVEL_READ_UNCOMMITTED
|
||||||
|
|
||||||
The :sql:`READ UNCOMMITTED` isolation level is defined in the SQL standard but not available in
|
The :sql:`READ UNCOMMITTED` isolation level is defined in the SQL standard
|
||||||
the |MVCC| model of PostgreSQL: it is replaced by the stricter :sql:`READ
|
but not available in the |MVCC| model of PostgreSQL: it is replaced by the
|
||||||
COMMITTED`.
|
stricter :sql:`READ COMMITTED`.
|
||||||
|
|
||||||
.. data:: ISOLATION_LEVEL_READ_COMMITTED
|
.. data:: ISOLATION_LEVEL_READ_COMMITTED
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ available through the following exceptions:
|
||||||
|
|
||||||
Exception that is the base class of all other error exceptions. You can
|
Exception that is the base class of all other error exceptions. You can
|
||||||
use this to catch all errors with one single ``except`` statement. Warnings
|
use this to catch all errors with one single ``except`` statement. Warnings
|
||||||
are not considered errors and thus should not use this class as base. It
|
are not considered errors and thus not use this class as base. It
|
||||||
is a subclass of the Python |StandardError|_.
|
is a subclass of the Python |StandardError|_.
|
||||||
|
|
||||||
.. attribute:: pgerror
|
.. attribute:: pgerror
|
||||||
|
|
|
@ -57,8 +57,8 @@ The main entry point of Psycopg are:
|
||||||
- send commands to the database using methods such as `~cursor.execute()`
|
- send commands to the database using methods such as `~cursor.execute()`
|
||||||
and `~cursor.executemany()`,
|
and `~cursor.executemany()`,
|
||||||
|
|
||||||
- retrieve data from the database using methods such as
|
- retrieve data from the database :ref:`by iteration <cursor-iterable>` or
|
||||||
`~cursor.fetchone()`, `~cursor.fetchmany()`,
|
using methods such as `~cursor.fetchone()`, `~cursor.fetchmany()`,
|
||||||
`~cursor.fetchall()`.
|
`~cursor.fetchall()`.
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ Unicode handling
|
||||||
Psycopg can exchange Unicode data with a PostgreSQL database. Python
|
Psycopg can exchange Unicode data with a PostgreSQL database. Python
|
||||||
`!unicode` objects are automatically *encoded* in the client encoding
|
`!unicode` objects are automatically *encoded* in the client encoding
|
||||||
defined on the database connection (the `PostgreSQL encoding`__, available in
|
defined on the database connection (the `PostgreSQL encoding`__, available in
|
||||||
`connection.encoding`, is translated into a `Python codec`__ using an
|
`connection.encoding`, is translated into a `Python codec`__ using the
|
||||||
`~psycopg2.extensions.encodings` mapping)::
|
`~psycopg2.extensions.encodings` mapping)::
|
||||||
|
|
||||||
>>> print u, type(u)
|
>>> print u, type(u)
|
||||||
|
@ -427,7 +427,7 @@ Psycopg wraps the database server side cursor in *named cursors*. A named
|
||||||
cursor is created using the `~connection.cursor()` method specifying the
|
cursor is created using the `~connection.cursor()` method specifying the
|
||||||
`name` parameter. Such cursor will behave mostly like a regular cursor,
|
`name` parameter. Such cursor will behave mostly like a regular cursor,
|
||||||
allowing the user to move in the dataset using the `~cursor.scroll()`
|
allowing the user to move in the dataset using the `~cursor.scroll()`
|
||||||
methog and to read the data using `~cursor.fetchone()` and
|
method and to read the data using `~cursor.fetchone()` and
|
||||||
`~cursor.fetchmany()` methods.
|
`~cursor.fetchmany()` methods.
|
||||||
|
|
||||||
.. |DECLARE| replace:: :sql:`DECLARE`
|
.. |DECLARE| replace:: :sql:`DECLARE`
|
||||||
|
@ -443,7 +443,7 @@ Thread safety
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
The Psycopg module is *thread-safe*: threads can access the same database
|
The Psycopg module is *thread-safe*: threads can access the same database
|
||||||
using separate session (by creating a `connection` per thread) or using
|
using separate sessions (by creating a `connection` per thread) or using
|
||||||
the same session (accessing to the same connection and creating separate
|
the same session (accessing to the same connection and creating separate
|
||||||
`cursor`\ s). In |DBAPI|_ parlance, Psycopg is *level 2 thread safe*.
|
`cursor`\ s). In |DBAPI|_ parlance, Psycopg is *level 2 thread safe*.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user