rda-python-common 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rda-python-common might be problematic. Click here for more details.
- rda_python_common/PgDBI.py +9 -7
- {rda_python_common-1.0.5.dist-info → rda_python_common-1.0.6.dist-info}/METADATA +1 -1
- {rda_python_common-1.0.5.dist-info → rda_python_common-1.0.6.dist-info}/RECORD +6 -6
- {rda_python_common-1.0.5.dist-info → rda_python_common-1.0.6.dist-info}/LICENSE +0 -0
- {rda_python_common-1.0.5.dist-info → rda_python_common-1.0.6.dist-info}/WHEEL +0 -0
- {rda_python_common-1.0.5.dist-info → rda_python_common-1.0.6.dist-info}/top_level.txt +0 -0
rda_python_common/PgDBI.py
CHANGED
|
@@ -37,7 +37,7 @@ CHCODE = 1042
|
|
|
37
37
|
|
|
38
38
|
# hard coded db ports for dbnames
|
|
39
39
|
DBPORTS = {
|
|
40
|
-
'default' :
|
|
40
|
+
'default' : 0
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
DBPASS = {}
|
|
@@ -517,9 +517,9 @@ def pgconnect(reconnect = 0, pgcnt = 0, autocommit = True):
|
|
|
517
517
|
config['host'] = PGDBI['DBHOST'] if PGDBI['DBHOST'] else PGDBI['DEFHOST']
|
|
518
518
|
if not PGDBI['DBPORT']: PGDBI['DBPORT'] = get_dbport(PGDBI['DBNAME'])
|
|
519
519
|
if PGDBI['DBPORT']: config['port'] = PGDBI['DBPORT']
|
|
520
|
-
config['password'] =
|
|
521
|
-
|
|
520
|
+
config['password'] = '***'
|
|
522
521
|
sqlstr = "psycopg2.connect(**{})".format(config)
|
|
522
|
+
config['password'] = get_pgpass_password()
|
|
523
523
|
if PgLOG.PGLOG['DBGLEVEL']: PgLOG.pgdbg(1000, sqlstr)
|
|
524
524
|
try:
|
|
525
525
|
PgLOG.PGLOG['PGDBBUF'] = pgdb = PgSQL.connect(**config)
|
|
@@ -2221,8 +2221,10 @@ def pgname(str, sign = None):
|
|
|
2221
2221
|
def get_pgpass_password():
|
|
2222
2222
|
|
|
2223
2223
|
if PGDBI['PWNAME']: return PGDBI['PWNAME']
|
|
2224
|
-
if not DBPASS: read_pgpass()
|
|
2225
|
-
|
|
2224
|
+
if not DBPASS: read_pgpass()
|
|
2225
|
+
dbport = str(PGDBI['DBPORT']) if PGDBI['DBPORT'] else '5432'
|
|
2226
|
+
pwname = DBPASS.get((PGDBI['DBSHOST'], dbport, PGDBI['DBNAME'], PGDBI['LNNAME']))
|
|
2227
|
+
if not pwname: pwname = DBPASS.get((PGDBI['DBHOST'], dbport, PGDBI['DBNAME'], PGDBI['LNNAME']))
|
|
2226
2228
|
|
|
2227
2229
|
#
|
|
2228
2230
|
# Reads the .pgpass file and returns a dictionary of credentials.
|
|
@@ -2234,7 +2236,7 @@ def read_pgpass():
|
|
|
2234
2236
|
for line in f:
|
|
2235
2237
|
line = line.strip()
|
|
2236
2238
|
if not line or line.startswith("#"): continue
|
|
2237
|
-
dbhost, dbport, dbname,
|
|
2238
|
-
DBPASS[(dbhost, dbport, dbname,
|
|
2239
|
+
dbhost, dbport, dbname, lnname, pwname = line.split(":")
|
|
2240
|
+
DBPASS[(dbhost, dbport, dbname, lnname)] = pwname
|
|
2239
2241
|
except FileNotFoundError:
|
|
2240
2242
|
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6
|
|
4
4
|
Summary: RDA Python common library codes shared by other RDA python packages
|
|
5
5
|
Author-email: Zaihua Ji <zji@ucar.edu>
|
|
6
6
|
Project-URL: Homepage, https://github.com/NCAR/rda-python-common
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
rda_python_common/PgCMD.py,sha256=dsFL_hiAHRZ-BwncgZhxQ7p9O10ox9lUSXOIePjZ-PQ,20487
|
|
2
|
-
rda_python_common/PgDBI.py,sha256=
|
|
2
|
+
rda_python_common/PgDBI.py,sha256=PKomitCuXSg4oyqZXPU4p0b3lMv0gG4MmXbMOuXIpzA,74268
|
|
3
3
|
rda_python_common/PgFile.py,sha256=FuAmumeiCBK1wUrMa7p0X7tpJcJqzlITz11ghEgLce8,96805
|
|
4
4
|
rda_python_common/PgGLBS.py,sha256=3vmCA5tUwpg3Xjq8rgo2WWkadLSGGbVyU9ScNGqucy8,6861
|
|
5
5
|
rda_python_common/PgLOG.py,sha256=dcIu6VTSYL9dvyyQfwuleqp52z6PMc1nEvtko_hSquM,53766
|
|
@@ -10,8 +10,8 @@ rda_python_common/PgSIG.py,sha256=oDXcSnnzW6wKm_cSpFxQZWAo2hpPPTcuNDYhPSNQcRc,35
|
|
|
10
10
|
rda_python_common/PgSplit.py,sha256=QKPbF55m8KCTGmwVwL3uG_nuylCC4FSVfLuXeLjJHbE,8816
|
|
11
11
|
rda_python_common/PgUtil.py,sha256=F1CVuhsNhfuRfZ4mEx9ocrHrspjrCrLIFHX1hQsufVc,48730
|
|
12
12
|
rda_python_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
rda_python_common-1.0.
|
|
14
|
-
rda_python_common-1.0.
|
|
15
|
-
rda_python_common-1.0.
|
|
16
|
-
rda_python_common-1.0.
|
|
17
|
-
rda_python_common-1.0.
|
|
13
|
+
rda_python_common-1.0.6.dist-info/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
|
|
14
|
+
rda_python_common-1.0.6.dist-info/METADATA,sha256=RVhPfZGmoLdg-kfTFj1gMvgwD0ALsDu6LRXgd542se0,629
|
|
15
|
+
rda_python_common-1.0.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
16
|
+
rda_python_common-1.0.6.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
|
|
17
|
+
rda_python_common-1.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|