@@ -15,51 +15,10 @@ API Reference
1515Connection
1616==========
1717
18- .. coroutinefunction :: connect(dsn=None, *, host=None, port=None, \
19- user=None, password=None, \
20- database=None, loop=None, timeout=60, \
21- statement_cache_size=100, \
22- command_timeout=None, \
23- **opts)
18+ .. autofunction :: asyncpg.connection.connect
2419
25- Establish a connection to a PostgreSQL server and return a new
26- :class: `~asyncpg.connection.Connection ` object.
2720
28- :param dsn: Connection arguments specified using as a single string in the
29- following format:
30- ``postgres://user:pass@host:port/database?option=value ``
31-
32- :param host: database host address or a path to the directory containing
33- database server UNIX socket (defaults to the default UNIX
34- socket, or the value of the ``PGHOST `` environment variable,
35- if set).
36-
37- :param port: connection port number (defaults to ``5432 ``, or the value of
38- the ``PGPORT `` environment variable, if set)
39-
40- :param user: the name of the database role used for authentication
41- (defaults to the name of the effective user of the process
42- making the connection, or the value of ``PGUSER `` environment
43- variable, if set)
44-
45- :param password: password used for authentication
46-
47- :param loop: An asyncio event loop instance. If ``None ``, the default
48- event loop will be used.
49-
50- :param float timeout: connection timeout (in seconds, defaults to 60
51- seconds).
52-
53- :param float statement_timeout: the default timeout for operations on
54- this connection (the default is no timeout).
55-
56- :param int statement_cache_size: the size of prepared statement LRU cache
57- (defaults to 100).
58-
59- :returns: :class: `~asyncpg.connection.Connection ` instance.
60-
61-
62- .. autoclass :: asyncpg.connection.Connection()
21+ .. autoclass :: asyncpg.connection.Connection
6322 :members:
6423
6524
@@ -149,6 +108,10 @@ Alternatively, transactions can be used without an ``async with`` block:
149108 await tr.commit()
150109
151110
111+ See also the
112+ :meth: `Connection.transaction() <asyncpg.connection.Connection.transaction> `
113+ function.
114+
152115.. _savepoint : https://www.postgresql.org/docs/current/static/sql-savepoint.html
153116
154117
@@ -233,15 +196,15 @@ It's also possible to create cursors from prepared statements:
233196 .. note ::
234197
235198 Cursors created by a call to
236- :meth: `Conection .cursor() <asyncpg.connection.Connection.cursor> ` or
199+ :meth: `Connection .cursor() <asyncpg.connection.Connection.cursor> ` or
237200 :meth: `PreparedStatement.cursor() <asyncpg.prepared_stmt.PreparedStatement.cursor> `
238201 are *non-scrollable *: they can only be read forwards. To create a scrollable
239202 cursor, use the ``DECLARE ... SCROLL CURSOR `` SQL statement directly.
240203
241204.. warning ::
242205
243206 Cursors created by a call to
244- :meth: `Conection .cursor() <asyncpg.connection.Connection.cursor> ` or
207+ :meth: `Connection .cursor() <asyncpg.connection.Connection.cursor> ` or
245208 :meth: `PreparedStatement.cursor() <asyncpg.prepared_stmt.PreparedStatement.cursor> `
246209 cannot be used outside of a transaction. Any such attempt will result in
247210 :exc: `~asyncpg.exceptions.InterfaceError `.
@@ -268,6 +231,18 @@ It's also possible to create cursors from prepared statements:
268231 :members:
269232
270233
234+ .. _asyncpg-api-pool :
235+
236+ Connection Pool
237+ ===============
238+
239+ .. autofunction :: asyncpg.pool.create_pool
240+
241+
242+ .. autoclass :: asyncpg.pool.Pool()
243+ :members:
244+
245+
271246.. _asyncpg-api-record :
272247
273248Record Objects
@@ -284,9 +259,14 @@ of values either by a numeric index or by a field name:
284259 >>> import asyncio
285260 >>> loop = asyncio.get_event_loop()
286261 >>> conn = loop.run_until_complete(asyncpg.connect())
287- >>> loop.run_until_complete(conn.fetchrow('''
262+ >>> r = loop.run_until_complete(conn.fetchrow('''
288263 ... SELECT oid, rolname, rolsuper FROM pg_roles WHERE rolname = user'''))
264+ >>> r
289265 <Record oid=16388 rolname='elvis' rolsuper=True>
266+ >>> r['oid']
267+ 16388
268+ >>> r[0]
269+ 16388
290270
291271
292272 .. class :: Record()
0 commit comments