Skip to content

Commit cda120d

Browse files
author
James William Pye
committed
Get rid of DSN.
Partially implemented, so it was probably closer to broken than useful. Remove any references in documentation and update pg_python.
1 parent 8e51820 commit cda120d

4 files changed

Lines changed: 22 additions & 43 deletions

File tree

postgresql/bin/pg_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def extract_parameters(src):
3939

4040
def command(args = sys.argv):
4141
p = clientparameters.DefaultParser(
42-
"%prog [connection options] [script] [-- script options] [args]",
42+
"%prog [connection options] [script] ...",
4343
version = '1.0',
4444
option_list = default_options
4545
)

postgresql/clientparameters.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from functools import partial
1818

1919
from . import iri as pg_iri
20-
from . import dsn as pg_dsn
2120
from . import pgpassfile as pg_pass
2221

2322
try:
@@ -252,15 +251,10 @@ def append_db_client_x_parameters(option, opt_str, value, parser):
252251
make_x_option = partial(make_option, callback = append_db_client_x_parameters)
253252

254253
option_iri = make_x_option('-I', '--iri',
255-
help = 'complete resource identifier, pq-IRI',
254+
help = 'database locator string',
256255
type = 'str',
257256
dest = 'pq_iri',
258257
)
259-
option_dsn = make_x_option('--dsn',
260-
help = 'DSN for connection',
261-
type = 'str',
262-
dest = 'pq_dsn',
263-
)
264258

265259
# PostgreSQL Standard Options
266260
standard_optparse_options = (
@@ -301,14 +295,13 @@ def _add_help_option(self):
301295
option_settings,
302296
# Complex Options
303297
option_iri,
304-
option_dsn,
305298
]
306299
default_optparse_options.extend(standard_optparse_options)
307300

308301
class DefaultParser(StandardParser):
309302
"""
310303
Parser that includes a variety of connectivity options.
311-
(IRI, DSN, sslmode, role(set role), settings)
304+
(IRI, sslmode, role(set role), settings)
312305
"""
313306
standard_option_list = default_optparse_options
314307

@@ -381,9 +374,6 @@ def denormalize_parameters(p):
381374
def x_pq_iri(iri, config):
382375
return denormalize_parameters(pg_iri.parse(iri))
383376

384-
def x_pq_dsn(dsn, config):
385-
return denormalize_parameters(pg_dsn.parse(dsn))
386-
387377
def x_pg_service(service_name, config):
388378
"""
389379
Lookup service data using the `service_name`.
@@ -424,7 +414,6 @@ def x_pg_ldap(ldap_url, config):
424414
default_x_callbacks = {
425415
'settings' : x_settings,
426416
'pq_iri' : x_pq_iri,
427-
'pq_dsn' : x_pq_dsn,
428417
'pg_service' : x_pg_service,
429418
'pg_ldap' : x_pg_ldap,
430419
}

postgresql/documentation/bin.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
Usage
1818
-----
1919
20-
Usage: pg_python [connection options] [script] [-- script options] [args]
20+
Usage: pg_python [Connection Options] [script or script designator] ...
2121
22-
Options:
22+
Connection Options:
2323
-d DATABASE, --database=DATABASE
2424
database's name
2525
-h hostname, --host=hostname
@@ -38,32 +38,39 @@
3838
-I IRI, --iri=IRI complete resource identifier, pq-IRI
3939
-1, --with-transaction
4040
run operation with a transaction block
41+
--pq-trace=PQ_TRACE trace PQ protocol transmissions
42+
4143
-C PYTHON_CONTEXT
4244
Python context code to
4345
run[file://,module:,<code>(__context__)]
4446
-m PYTHON_MAIN Python module to run as script(__main__)
4547
-c PYTHON_MAIN Python expression to run(__main__)
46-
--pq-trace=PQ_TRACE trace PQ protocol transmissions
4748
--version show program's version number and exit
4849
--help show this help message and exit
4950
51+
5052
Python Environment
5153
------------------
5254
5355
``pg_python`` creates a Python environment with an already established
5456
connection based on the given arguments. It provides the following additional
5557
builtins:
5658
57-
- ``db`` (the connection object)
58-
- ``xact`` (db.xact)
59-
- ``settings`` (db.settings)
60-
- ``prepare`` (db.prepare)
61-
- ``proc`` (db.proc)
59+
``db``
60+
The PG-API connection object.
61+
62+
``xact``
63+
``db.xact``
64+
65+
``settings``
66+
``db.settings``
67+
68+
``prepare``
69+
``db.prepare``
70+
71+
``proc``
72+
``db.proc``
6273
63-
All of these are provided for convenience. With a single target being the
64-
primary use-case, ambiguity is not an issue. Surely, saving four characters for
65-
accessing each of these is not substantial, but it helps keep code concise and
66-
tends to be very useful when using ``pg_python`` interactively.
6774
6875
Interactive Console Backslash Commands
6976
--------------------------------------

postgresql/dsn.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)