rda-python-common 3.0.0__tar.gz → 3.0.2__tar.gz
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.
- {rda_python_common-3.0.0/src/rda_python_common.egg-info → rda_python_common-3.0.2}/PKG-INFO +1 -1
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/pyproject.toml +1 -1
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgDBI.py +6 -21
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_dbi.py +11 -29
- {rda_python_common-3.0.0 → rda_python_common-3.0.2/src/rda_python_common.egg-info}/PKG-INFO +1 -1
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/LICENSE +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/README.md +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/setup.cfg +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgCMD.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgFile.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgLOG.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgLock.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgOPT.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgSIG.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgSplit.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/PgUtil.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/__init__.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_cmd.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_file.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_lock.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_log.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_opt.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_password.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_sig.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_split.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pg_util.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pgpassword.py +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common/pgpassword.usg +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/entry_points.txt +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/requires.txt +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/top_level.txt +0 -0
- {rda_python_common-3.0.0 → rda_python_common-3.0.2}/test/test_common.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.2
|
|
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
|
|
@@ -328,8 +328,12 @@ def starttran():
|
|
|
328
328
|
pgconnect(0, 0, False)
|
|
329
329
|
else:
|
|
330
330
|
try:
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
# Liveness probe: psycopg2's isolation_level getter could raise on a
|
|
332
|
+
# dead connection, but psycopg3's is a cached attribute that never
|
|
333
|
+
# touches the server. A trivial round-trip detects a broken
|
|
334
|
+
# connection under either driver.
|
|
335
|
+
pgdb.cursor().execute("SELECT 1")
|
|
336
|
+
except PgSQL.Error as e:
|
|
333
337
|
pgconnect(0, 0, False)
|
|
334
338
|
if pgdb.closed:
|
|
335
339
|
pgconnect(0, 0, False)
|
|
@@ -1714,25 +1718,6 @@ def reset_rdadb_version(dsid):
|
|
|
1714
1718
|
|
|
1715
1719
|
pgexec("UPDATE dataset SET version = version + 1 WHERE dsid = '{}'".format(dsid), PGDBI['ERRLOG'])
|
|
1716
1720
|
|
|
1717
|
-
#
|
|
1718
|
-
# check the use rdadb flag in table dataset for a given dataset and given values
|
|
1719
|
-
#
|
|
1720
|
-
def use_rdadb(dsid, logact = 0, vals = None):
|
|
1721
|
-
|
|
1722
|
-
ret = '' # default to empty in case dataset not in RDADB
|
|
1723
|
-
if dsid:
|
|
1724
|
-
pgrec = pgget("dataset", "use_rdadb", "dsid = '{}'".format(dsid), PGDBI['EXITLG'])
|
|
1725
|
-
if pgrec:
|
|
1726
|
-
ret = 'N' # default to 'N' if dataset record in RDADB already
|
|
1727
|
-
if pgrec['use_rdadb']:
|
|
1728
|
-
if not vals: vals = "IPYMW" # default to Internal; Publishable; Yes RDADB
|
|
1729
|
-
if vals.find(pgrec['use_rdadb']) > -1:
|
|
1730
|
-
ret = pgrec['use_rdadb']
|
|
1731
|
-
elif logact:
|
|
1732
|
-
PgLOG.pglog("Dataset '{}' is not in RDADB!".format(dsid), logact)
|
|
1733
|
-
|
|
1734
|
-
return ret
|
|
1735
|
-
|
|
1736
1721
|
#
|
|
1737
1722
|
# fld: field name for querry condition
|
|
1738
1723
|
# vals: reference to aaray of values
|
|
@@ -410,8 +410,12 @@ class PgDBI(PgLOG):
|
|
|
410
410
|
self.pgconnect(0, 0, False)
|
|
411
411
|
else:
|
|
412
412
|
try:
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
# Liveness probe: psycopg2's isolation_level getter could raise on a
|
|
414
|
+
# dead connection, but psycopg3's is a cached attribute that never
|
|
415
|
+
# touches the server. A trivial round-trip detects a broken
|
|
416
|
+
# connection under either driver.
|
|
417
|
+
self.pgdb.cursor().execute("SELECT 1")
|
|
418
|
+
except PgSQL.Error as e:
|
|
415
419
|
self.pgconnect(0, 0, False)
|
|
416
420
|
if self.pgdb.closed:
|
|
417
421
|
self.pgconnect(0, 0, False)
|
|
@@ -533,7 +537,11 @@ class PgDBI(PgLOG):
|
|
|
533
537
|
dberror (str): Full database error string to inspect.
|
|
534
538
|
logact (int): Logging action flags forwarded to add_new_table().
|
|
535
539
|
"""
|
|
536
|
-
|
|
540
|
+
# The caller (check_dberror) only invokes this after pgcode == '42P01', so
|
|
541
|
+
# match just the relation message. psycopg2's pgerror includes the
|
|
542
|
+
# 'ERROR: ' severity prefix while psycopg3's message_primary does not, so
|
|
543
|
+
# anchoring on that prefix only matched under psycopg2.
|
|
544
|
+
ms = re.search(r'relation "(.+)" does not exist', dberror)
|
|
537
545
|
if ms:
|
|
538
546
|
tname = ms.group(1)
|
|
539
547
|
self.add_new_table(tname, logact = logact)
|
|
@@ -1986,32 +1994,6 @@ class PgDBI(PgLOG):
|
|
|
1986
1994
|
"""
|
|
1987
1995
|
self.pgexec("UPDATE dataset SET version = version + 1 WHERE dsid = '{}'".format(dsid), self.PGDBI['ERRLOG'])
|
|
1988
1996
|
|
|
1989
|
-
def use_rdadb(self, dsid, logact = 0, vals = None):
|
|
1990
|
-
"""Return the use_rdadb flag for a dataset if it matches an allowed set.
|
|
1991
|
-
|
|
1992
|
-
Args:
|
|
1993
|
-
dsid (str | None): Dataset ID to query.
|
|
1994
|
-
logact (int): Logging action flags for missing-dataset warnings; default 0.
|
|
1995
|
-
vals (str | None): Accepted flag characters; defaults to 'IPYMW' when None.
|
|
1996
|
-
|
|
1997
|
-
Returns:
|
|
1998
|
-
str: The use_rdadb flag character when found and in vals; 'N' when the
|
|
1999
|
-
dataset exists but the flag is not in vals; '' when dsid is falsy
|
|
2000
|
-
or the dataset is not in RDADB.
|
|
2001
|
-
"""
|
|
2002
|
-
ret = '' # default to empty in case dataset not in RDADB
|
|
2003
|
-
if dsid:
|
|
2004
|
-
pgrec = self.pgget("dataset", "use_rdadb", "dsid = '{}'".format(dsid), self.PGDBI['EXITLG'])
|
|
2005
|
-
if pgrec:
|
|
2006
|
-
ret = 'N' # default to 'N' if dataset record in RDADB already
|
|
2007
|
-
if pgrec['use_rdadb']:
|
|
2008
|
-
if not vals: vals = "IPYMW" # default to Internal; Publishable; Yes RDADB
|
|
2009
|
-
if vals.find(pgrec['use_rdadb']) > -1:
|
|
2010
|
-
ret = pgrec['use_rdadb']
|
|
2011
|
-
elif logact:
|
|
2012
|
-
self.pglog("Dataset '{}' is not in RDADB!".format(dsid), logact)
|
|
2013
|
-
return ret
|
|
2014
|
-
|
|
2015
1997
|
def get_field_condition(self, fld, vals, isstr = 0, noand = 0):
|
|
2016
1998
|
"""Build a SQL condition fragment for a field given a list of values.
|
|
2017
1999
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rda_python_common
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.2
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/requires.txt
RENAMED
|
File without changes
|
{rda_python_common-3.0.0 → rda_python_common-3.0.2}/src/rda_python_common.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|