rda-python-common 1.0.39__py3-none-any.whl → 1.0.41__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 +10 -7
- rda_python_common/PgLOG.py +26 -19
- {rda_python_common-1.0.39.dist-info → rda_python_common-1.0.41.dist-info}/METADATA +1 -1
- {rda_python_common-1.0.39.dist-info → rda_python_common-1.0.41.dist-info}/RECORD +7 -7
- {rda_python_common-1.0.39.dist-info → rda_python_common-1.0.41.dist-info}/WHEEL +0 -0
- {rda_python_common-1.0.39.dist-info → rda_python_common-1.0.41.dist-info}/licenses/LICENSE +0 -0
- {rda_python_common-1.0.39.dist-info → rda_python_common-1.0.41.dist-info}/top_level.txt +0 -0
rda_python_common/PgDBI.py
CHANGED
|
@@ -46,6 +46,8 @@ DBPASS = {}
|
|
|
46
46
|
DBNAMES = {
|
|
47
47
|
'ivaddb' : 'ivaddb',
|
|
48
48
|
'cntldb' : 'ivaddb',
|
|
49
|
+
'ivaddb1' : 'ivaddb',
|
|
50
|
+
'cntldb1' : 'ivaddb',
|
|
49
51
|
'cdmsdb' : 'ivaddb',
|
|
50
52
|
'ispddb' : 'ispddb',
|
|
51
53
|
'obsua' : 'upadb',
|
|
@@ -113,20 +115,21 @@ PGDBI['SCPATH'] = None # additional schema path for set search_path
|
|
|
113
115
|
PGDBI['VHSET'] = 0
|
|
114
116
|
PGDBI['PGSIZE'] = 1000 # number of records for page_size
|
|
115
117
|
PGDBI['MTRANS'] = 5000 # max number of changes in one transactions
|
|
116
|
-
PGDBI['MAXICNT'] =
|
|
118
|
+
PGDBI['MAXICNT'] = 6000000 # maximum number of records in each table
|
|
117
119
|
|
|
118
120
|
#
|
|
119
121
|
# create a pgddl command string with
|
|
120
122
|
# table name (tname), prefix (pre) and suffix (suf)
|
|
121
123
|
#
|
|
122
|
-
def get_pgddl_command(tname, pre = None, suf = None):
|
|
124
|
+
def get_pgddl_command(tname, pre = None, suf = None, scname = None):
|
|
123
125
|
|
|
124
126
|
ms = re.match(r'^(.+)\.(.+)$', tname)
|
|
125
|
-
if
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
if not scname:
|
|
128
|
+
if ms:
|
|
129
|
+
scname = ms.group(1)
|
|
130
|
+
tname = ms.group(2)
|
|
131
|
+
else:
|
|
132
|
+
scname = PGDBI['SCNAME']
|
|
130
133
|
xy = ''
|
|
131
134
|
if suf: xy += ' -x ' + suf
|
|
132
135
|
if pre: xy += ' -y ' + pre
|
rda_python_common/PgLOG.py
CHANGED
|
@@ -440,35 +440,42 @@ def pglog(msg, logact = MSGLOG):
|
|
|
440
440
|
if not logact&NOTLOG:
|
|
441
441
|
if logact&ERRLOG:
|
|
442
442
|
if not PGLOG['ERRFILE']: PGLOG['ERRFILE'] = re.sub(r'.log$', '.err', PGLOG['LOGFILE'])
|
|
443
|
-
|
|
444
|
-
ERR = open("{}/{}".format(PGLOG['LOGPATH'], PGLOG['ERRFILE']), 'a')
|
|
445
|
-
except FileNotFoundError:
|
|
446
|
-
ERR = open("error.log", 'a')
|
|
447
|
-
ERR.write(f"Error File not found: {PGLOG['LOGPATH']}/{PGLOG['ERRFILE']}")
|
|
448
|
-
ERR.write(msg)
|
|
449
|
-
if not logact&(EMLALL|SKPTRC): ERR.write(get_call_trace())
|
|
450
|
-
ERR.close()
|
|
443
|
+
write_message(msg, f"{PGLOG['LOGPATH']}/{PGLOG['ERRFILE']}", logact)
|
|
451
444
|
if logact&EXITLG:
|
|
452
|
-
|
|
453
|
-
LOG.write(cmdstr)
|
|
454
|
-
LOG.close()
|
|
445
|
+
write_message(cmdstr, f"{PGLOG['LOGPATH']}/{PGLOG['LOGFILE']}", logact)
|
|
455
446
|
else:
|
|
456
|
-
|
|
457
|
-
LOG.write(msg)
|
|
458
|
-
LOG.close()
|
|
447
|
+
write_message(msg, f"{PGLOG['LOGPATH']}/{PGLOG['LOGFILE']}", logact)
|
|
459
448
|
|
|
460
449
|
if not PGLOG['BCKGRND'] and logact&(ERRLOG|WARNLG):
|
|
461
|
-
|
|
462
|
-
if logact&BRKLIN: OUT.write("\n")
|
|
463
|
-
if logact&SEPLIN: OUT.write(PGLOG['SEPLINE'])
|
|
464
|
-
OUT.write(msg)
|
|
465
|
-
|
|
450
|
+
write_message(msg, None, logact)
|
|
466
451
|
|
|
467
452
|
if logact&EXITLG:
|
|
468
453
|
pgexit(1)
|
|
469
454
|
else:
|
|
470
455
|
return (retmsg if retmsg else FAILURE)
|
|
471
456
|
|
|
457
|
+
#
|
|
458
|
+
# write a log message
|
|
459
|
+
#
|
|
460
|
+
def write_message(msg, file, logact):
|
|
461
|
+
|
|
462
|
+
doclose = False
|
|
463
|
+
errlog = logact&ERRLOG
|
|
464
|
+
if file:
|
|
465
|
+
try:
|
|
466
|
+
OUT = open(file, 'a')
|
|
467
|
+
doclose = True
|
|
468
|
+
except FileNotFoundError:
|
|
469
|
+
OUT = sys.stderr if logact&(ERRLOG|EXITLG) else sys.stdout
|
|
470
|
+
OUT.write(f"Log File not found: {file}")
|
|
471
|
+
else:
|
|
472
|
+
OUT = sys.stderr if logact&(ERRLOG|EXITLG) else sys.stdout
|
|
473
|
+
if logact&BRKLIN: OUT.write("\n")
|
|
474
|
+
if logact&SEPLIN: OUT.write(PGLOG['SEPLINE'])
|
|
475
|
+
OUT.write(msg)
|
|
476
|
+
if errlog and not logact&(EMLALL|SKPTRC): OUT.write(get_call_trace())
|
|
477
|
+
if doclose: OUT.close()
|
|
478
|
+
|
|
472
479
|
#
|
|
473
480
|
# check and disconnet database before exit
|
|
474
481
|
#
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.41
|
|
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,15 +1,15 @@
|
|
|
1
1
|
rda_python_common/PgCMD.py,sha256=EYjG2Z4zEnvsXE1z-jt5UaNoEKxnOYYiMMzvW6HrKA4,20597
|
|
2
|
-
rda_python_common/PgDBI.py,sha256=
|
|
2
|
+
rda_python_common/PgDBI.py,sha256=vyjQSgXRh8THM7Gez5leix9Xv3oz8KsYxppjlbA9Rak,74755
|
|
3
3
|
rda_python_common/PgFile.py,sha256=gJuzBxLRYo3HQyNW1WNYDsQWRei2cco9bYEb6uOL8Ds,98487
|
|
4
|
-
rda_python_common/PgLOG.py,sha256=
|
|
4
|
+
rda_python_common/PgLOG.py,sha256=vjjxWZoh98IQbGk5BEXuxKNH4aqmyw4vp_LbsunAQwE,55359
|
|
5
5
|
rda_python_common/PgLock.py,sha256=12i84nsGBuifSyPnm8IR63LvHvRuVU573D5QKFlHdOI,22623
|
|
6
6
|
rda_python_common/PgOPT.py,sha256=Sf--l5iKY82xF5NbXxEy8PWip7ACpaa3KLdMac7E-oc,56047
|
|
7
7
|
rda_python_common/PgSIG.py,sha256=ZVM9Qz6yIFurwIQJtV5-CFbKOTdFsZ-Rs95SEpDFgNk,35795
|
|
8
8
|
rda_python_common/PgSplit.py,sha256=QKPbF55m8KCTGmwVwL3uG_nuylCC4FSVfLuXeLjJHbE,8816
|
|
9
9
|
rda_python_common/PgUtil.py,sha256=OqESKCd72b9g8m8jwjPJhXDtPYlW6G8oSOhwChvz2Cg,48600
|
|
10
10
|
rda_python_common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
rda_python_common-1.0.
|
|
12
|
-
rda_python_common-1.0.
|
|
13
|
-
rda_python_common-1.0.
|
|
14
|
-
rda_python_common-1.0.
|
|
15
|
-
rda_python_common-1.0.
|
|
11
|
+
rda_python_common-1.0.41.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
|
|
12
|
+
rda_python_common-1.0.41.dist-info/METADATA,sha256=Zr3npavfO9dh27Gxflia09Sgr1w45TV-fsgm7QVfW1w,716
|
|
13
|
+
rda_python_common-1.0.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
rda_python_common-1.0.41.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
|
|
15
|
+
rda_python_common-1.0.41.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|