Title: [992] Document how to send more parameters with connect
- Revision
- 992
- Author
- cito
- Date
- 2019-04-24 16:16:19 -0400 (Wed, 24 Apr 2019)
Log Message
Document how to send more parameters with connect
Modified Paths
Diff
Modified: branches/5.0.x/docs/contents/pg/module.rst (991 => 992)
--- branches/5.0.x/docs/contents/pg/module.rst 2019-04-24 19:46:20 UTC (rev 991)
+++ branches/5.0.x/docs/contents/pg/module.rst 2019-04-24 20:16:19 UTC (rev 992)
@@ -46,15 +46,22 @@
This function opens a connection to a specified database on a given
PostgreSQL server. You can use keywords here, as described in the
Python tutorial. The names of the keywords are the name of the
-parameters given in the syntax line. For a precise description
+parameters given in the syntax line. The ``opt`` parameter can be used
+to pass command-line options to the server. For a precise description
of the parameters, please refer to the PostgreSQL user manual.
+If you want to add additional parameters not specified here, you must
+pass a connection string or a connection URI instead of the ``dbname``
+(as in ``con3`` and ``con4`` in the following example).
+
Example::
import pg
- con1 = pg.connect('testdb', 'myhost', 5432, None, None, 'bob', None)
- con2 = pg.connect(dbname='testdb', host='localhost', user='bob')
+ con1 = pg.connect('testdb', 'myhost', 5432, None, 'bob', None)
+ con2 = pg.connect(dbname='testdb', host='myhost', user='bob')
+ con3 = pg.connect('host=myhost user=bob dbname=testdb connect_timeout=10')
+ con4 = pg.connect('postgresql://bob@myhost/testdb?connect_timeout=10')
get/set_defhost -- default server host [DV]
-------------------------------------------
Modified: trunk/docs/contents/pg/module.rst (991 => 992)
--- trunk/docs/contents/pg/module.rst 2019-04-24 19:46:20 UTC (rev 991)
+++ trunk/docs/contents/pg/module.rst 2019-04-24 20:16:19 UTC (rev 992)
@@ -46,15 +46,22 @@
This function opens a connection to a specified database on a given
PostgreSQL server. You can use keywords here, as described in the
Python tutorial. The names of the keywords are the name of the
-parameters given in the syntax line. For a precise description
+parameters given in the syntax line. The ``opt`` parameter can be used
+to pass command-line options to the server. For a precise description
of the parameters, please refer to the PostgreSQL user manual.
+If you want to add additional parameters not specified here, you must
+pass a connection string or a connection URI instead of the ``dbname``
+(as in ``con3`` and ``con4`` in the following example).
+
Example::
import pg
- con1 = pg.connect('testdb', 'myhost', 5432, None, None, 'bob', None)
- con2 = pg.connect(dbname='testdb', host='localhost', user='bob')
+ con1 = pg.connect('testdb', 'myhost', 5432, None, 'bob', None)
+ con2 = pg.connect(dbname='testdb', host='myhost', user='bob')
+ con3 = pg.connect('host=myhost user=bob dbname=testdb connect_timeout=10')
+ con4 = pg.connect('postgresql://bob@myhost/testdb?connect_timeout=10')
get/set_defhost -- default server host [DV]
-------------------------------------------
_______________________________________________
PyGreSQL mailing list
PyGreSQL@Vex.Net
https://mail.vex.net/mailman/listinfo/pygresql