Skip to content

Commit e003bbb

Browse files
author
James William Pye
committed
Use 'db.' to clearly designate what the items in the list are.
1 parent 20a87a8 commit e003bbb

1 file changed

Lines changed: 20 additions & 17 deletions

File tree

postgresql/documentation/driver.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -281,43 +281,46 @@
281281
Database Interface Points
282282
-------------------------
283283
284-
After a connection is established, the primary interface points are ready for
285-
use. These entry points exist as properties and methods on the connection
286-
object:
284+
After a connection is established::
287285
288-
``prepare(sql_statement_string)``
286+
>>> import postgresql
287+
>>> db = postgresql.open(...)
288+
289+
The methods and properties on the connection object are ready for use:
290+
291+
``db.prepare(sql_statement_string)``
289292
Create a `postgresql.api.PreparedStatement` object for querying the database.
290293
This provides an "SQL statement template" that can be executed multiple times.
291294
See `Prepared Statements`_ for more information.
292295
293-
``proc(procedure_id)``
296+
``db.proc(procedure_id)``
294297
Create a `postgresql.api.StoredProcedure` object referring to a stored
295298
procedure on the database. The returned object will provide a
296299
`collections.Callable` interface to the stored procedure on the server. See
297300
`Stored Procedures`_ for more information.
298301
299-
``statement_from_id(statement_id)``
302+
``db.statement_from_id(statement_id)``
300303
Create a `postgresql.api.PreparedStatement` object from an existing statement
301304
identifier. This is used in cases where the statement was prepared on the
302305
server. See `Prepared Statements`_ for more information.
303306
304-
``cursor_from_id(cursor_id)``
307+
``db.cursor_from_id(cursor_id)``
305308
Create a `postgresql.api.Cursor` object from an existing cursor identifier.
306309
This is used in cases where the cursor was declared on the server. See
307310
`Cursors`_ for more information.
308311
309-
``execute(sql_statements_string)``
312+
``db.execute(sql_statements_string)``
310313
Run a block of SQL on the server. This method returns `None` unless an error
311314
occurs. If errors occur, the processing of the statements will stop and the
312315
the error will be raised.
313316
314-
``xact(gid = None, isolation = None, mode = None)``
317+
``db.xact(gid = None, isolation = None, mode = None)``
315318
The `postgresql.api.Transaction` constructor for creating transactions.
316319
This method creates a transaction reference. The transaction will not be
317320
started until it's instructed to do so. See `Transactions`_ for more
318321
information.
319322
320-
``settings``
323+
``db.settings``
321324
A property providing a `collections.MutableMapping` interface to the
322325
database's SQL settings. See `Settings`_ for more information.
323326
@@ -329,26 +332,26 @@
329332
the backend. The following are the attributes set on the connection object after
330333
the connection is made:
331334
332-
``version``
335+
``db.version``
333336
The results of ``SELECT version()``.
334337
335-
``version_info``
338+
``db.version_info``
336339
A ``sys.version_info`` form of the ``server_version`` setting. eg. ``(8, 1, 2,
337340
'final', 0)``.
338341
339-
``security``
342+
``db.security``
340343
`None` if no security. ``'ssl'`` if SSL is enabled.
341344
342-
``backend_id``
345+
``db.backend_id``
343346
The process-id of the backend process.
344347
345-
``backend_start``
348+
``db.backend_start``
346349
When backend was started. ``datetime.datetime`` instance.
347350
348-
``client_address``
351+
``db.client_address``
349352
The address of the client that the backend is communicating with.
350353
351-
``client_port``
354+
``db.client_port``
352355
The port of the client that the backend is communicating with.
353356
354357
The latter three are collected from pg_stat_activity. If this information is

0 commit comments

Comments
 (0)