Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5da519a
Create blank.yml
zaihuaji Jan 7, 2025
216ba11
add all files
Jan 7, 2025
e2086a9
delete yaml files
Jan 7, 2025
da7119a
Create publish.yml
zaihuaji Jan 7, 2025
46d28bd
Create python-app.yml
zaihuaji Jan 7, 2025
db9c148
Delete .github/workflows/blank.yml
zaihuaji Jan 7, 2025
d2a70bb
Update pyproject.toml for the project
zaihuaji Jan 7, 2025
cbf73b6
add module files
Jan 7, 2025
5df4ff2
Update PgUtil.py by removing leading PgUtil.
zaihuaji Jan 8, 2025
5db3a8d
remove root file PgDBI.py
Jan 8, 2025
34d7443
Merge pull request #1 from NCAR/init-with-rda-ispd-python
zaihuaji Jan 8, 2025
4311f36
Fix bug in PgUtil.py
Jan 8, 2025
192f2f4
Fix bug in PgUtil.py
Jan 8, 2025
df8fd2d
Fix undefined variables
Jan 8, 2025
077ed77
Fix undefined variables
Jan 8, 2025
46a8248
Create requirements.txt
zaihuaji Jan 8, 2025
a9f3fc5
PgSQL.OperationalError
Jan 8, 2025
a3d7229
Merge pull request #2 from NCAR/init-with-rda-ispd-python
zaihuaji Jan 8, 2025
9fec26f
Update publish.yml
zaihuaji Jan 8, 2025
48c5de9
Update PgLOG.py for convert_chars()
zaihuaji Jan 9, 2025
9b7cd16
Delete scripts/fill_ispddb.py
zaihuaji Jan 14, 2025
3cdc243
Update PgLOG.py
zaihuaji Jan 14, 2025
568ceca
Update python-app.yml to add --indent-size=3
zaihuaji Jan 14, 2025
36c4892
Merge pull request #3 from NCAR/init-with-rda-ispd-python
zaihuaji Jan 14, 2025
4abfc19
Update pyproject.toml for v1.0.1
zaihuaji Jan 14, 2025
9e66994
add from . to import local modile
Jan 22, 2025
0cc01ca
Merge pull request #4 from NCAR/hua-work-common
zaihuaji Jan 22, 2025
87a3de1
Update pyproject.toml
zaihuaji Jan 22, 2025
c67bccd
Merge pull request #5 from NCAR/zaihuaji-patch-1
zaihuaji Jan 22, 2025
479f5f0
use .pgpass file for db passwords
Jan 23, 2025
d1609a0
version to 1.0.4
Jan 23, 2025
2977273
Merge branch 'main' into hua-work-common
zaihuaji Jan 23, 2025
c538099
fix syntax error
Jan 23, 2025
4d0a8d5
save
Jan 23, 2025
4d0b7b4
Update PgDBI.py
zaihuaji Jan 23, 2025
799528b
Merge branch 'hua-work-common' of https://github.com/NCAR/rda-python-…
Jan 23, 2025
b2788b8
USNAME -> LNNAME
Jan 23, 2025
ba55341
1.0.4 to 1.0.5
Jan 27, 2025
e1f8cb8
Merge branch 'hua-work-common' of https://github.com/NCAR/rda-python-…
Jan 27, 2025
5807f78
dbport as a string to search for pwname
Jan 30, 2025
1ce96d8
=> 1.0.6
Jan 30, 2025
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 = "1.0.5"
version = "1.0.6"

authors = [
{ name="Zaihua Ji", email="zji@ucar.edu" },
Expand Down
16 changes: 9 additions & 7 deletions src/rda_python_common/PgDBI.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

# hard coded db ports for dbnames
DBPORTS = {
'default' : 5432
'default' : 0
}

DBPASS = {}
Expand Down Expand Up @@ -517,9 +517,9 @@ def pgconnect(reconnect = 0, pgcnt = 0, autocommit = True):
config['host'] = PGDBI['DBHOST'] if PGDBI['DBHOST'] else PGDBI['DEFHOST']
if not PGDBI['DBPORT']: PGDBI['DBPORT'] = get_dbport(PGDBI['DBNAME'])
if PGDBI['DBPORT']: config['port'] = PGDBI['DBPORT']
config['password'] = get_pgpass_password()

config['password'] = '***'
sqlstr = "psycopg2.connect(**{})".format(config)
config['password'] = get_pgpass_password()
if PgLOG.PGLOG['DBGLEVEL']: PgLOG.pgdbg(1000, sqlstr)
try:
PgLOG.PGLOG['PGDBBUF'] = pgdb = PgSQL.connect(**config)
Expand Down Expand Up @@ -2221,8 +2221,10 @@ def pgname(str, sign = None):
def get_pgpass_password():

if PGDBI['PWNAME']: return PGDBI['PWNAME']
if not DBPASS: read_pgpass()
return DBPASS.get((PGDBI['DBSHOST'], PGDBI['DBPORT'], PGDBI['DBNAME'], PGDBI['LNNAME']))
if not DBPASS: read_pgpass()
dbport = str(PGDBI['DBPORT']) if PGDBI['DBPORT'] else '5432'
pwname = DBPASS.get((PGDBI['DBSHOST'], dbport, PGDBI['DBNAME'], PGDBI['LNNAME']))
if not pwname: pwname = DBPASS.get((PGDBI['DBHOST'], dbport, PGDBI['DBNAME'], PGDBI['LNNAME']))

#
# Reads the .pgpass file and returns a dictionary of credentials.
Expand All @@ -2234,7 +2236,7 @@ def read_pgpass():
for line in f:
line = line.strip()
if not line or line.startswith("#"): continue
dbhost, dbport, dbname, usname, pwname = line.split(":")
DBPASS[(dbhost, dbport, dbname, usname)] = pwname
dbhost, dbport, dbname, lnname, pwname = line.split(":")
DBPASS[(dbhost, dbport, dbname, lnname)] = pwname
except FileNotFoundError:
pass