Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rda_python_common"
version = "3.0.1"
version = "3.0.2"
authors = [
Comment on lines 5 to 8
{ name="Zaihua Ji", email="zji@ucar.edu" },
]
Expand Down
19 changes: 0 additions & 19 deletions src/rda_python_common/PgDBI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1718,25 +1718,6 @@ def reset_rdadb_version(dsid):

pgexec("UPDATE dataset SET version = version + 1 WHERE dsid = '{}'".format(dsid), PGDBI['ERRLOG'])

#
# check the use rdadb flag in table dataset for a given dataset and given values
#
def use_rdadb(dsid, logact = 0, vals = None):

ret = '' # default to empty in case dataset not in RDADB
if dsid:
pgrec = pgget("dataset", "use_rdadb", "dsid = '{}'".format(dsid), PGDBI['EXITLG'])
if pgrec:
ret = 'N' # default to 'N' if dataset record in RDADB already
if pgrec['use_rdadb']:
if not vals: vals = "IPYMW" # default to Internal; Publishable; Yes RDADB
if vals.find(pgrec['use_rdadb']) > -1:
ret = pgrec['use_rdadb']
elif logact:
PgLOG.pglog("Dataset '{}' is not in RDADB!".format(dsid), logact)

return ret

#
# fld: field name for querry condition
# vals: reference to aaray of values
Expand Down
26 changes: 0 additions & 26 deletions src/rda_python_common/pg_dbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1994,32 +1994,6 @@ def reset_rdadb_version(self, dsid):
"""
self.pgexec("UPDATE dataset SET version = version + 1 WHERE dsid = '{}'".format(dsid), self.PGDBI['ERRLOG'])

def use_rdadb(self, dsid, logact = 0, vals = None):
"""Return the use_rdadb flag for a dataset if it matches an allowed set.

Args:
dsid (str | None): Dataset ID to query.
logact (int): Logging action flags for missing-dataset warnings; default 0.
vals (str | None): Accepted flag characters; defaults to 'IPYMW' when None.

Returns:
str: The use_rdadb flag character when found and in vals; 'N' when the
dataset exists but the flag is not in vals; '' when dsid is falsy
or the dataset is not in RDADB.
"""
ret = '' # default to empty in case dataset not in RDADB
if dsid:
pgrec = self.pgget("dataset", "use_rdadb", "dsid = '{}'".format(dsid), self.PGDBI['EXITLG'])
if pgrec:
ret = 'N' # default to 'N' if dataset record in RDADB already
if pgrec['use_rdadb']:
if not vals: vals = "IPYMW" # default to Internal; Publishable; Yes RDADB
if vals.find(pgrec['use_rdadb']) > -1:
ret = pgrec['use_rdadb']
elif logact:
self.pglog("Dataset '{}' is not in RDADB!".format(dsid), logact)
return ret

def get_field_condition(self, fld, vals, isstr = 0, noand = 0):
"""Build a SQL condition fragment for a field given a list of values.

Expand Down
Loading