rda-python-common 3.0.0__py3-none-any.whl → 3.0.1__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.
@@ -328,8 +328,12 @@ def starttran():
328
328
  pgconnect(0, 0, False)
329
329
  else:
330
330
  try:
331
- pgdb.isolation_level
332
- except PgSQL.OperationalError as e:
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)
@@ -410,8 +410,12 @@ class PgDBI(PgLOG):
410
410
  self.pgconnect(0, 0, False)
411
411
  else:
412
412
  try:
413
- self.pgdb.isolation_level
414
- except PgSQL.OperationalError as e:
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
- ms = re.match(r'^42P01 ERROR: relation "(.+)" does not exist', dberror)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 3.0.0
3
+ Version: 3.0.1
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=EYjG2Z4zEnvsXE1z-jt5UaNoEKxnOYYiMMzvW6HrKA4,20597
2
- rda_python_common/PgDBI.py,sha256=PEpZ5DyUuLf-xtdtXdovKxdrNAMkCTHXXH7BUyosp9M,78129
2
+ rda_python_common/PgDBI.py,sha256=e8skOqqIOPQ3_O33b-LFTVfnHRZYe6hYoS8-MoQJF6E,78398
3
3
  rda_python_common/PgFile.py,sha256=y_Gxi-54cyb1jpJRKNl3OlOm8I3WG7JuvgANWJ7PDE8,99372
4
4
  rda_python_common/PgLOG.py,sha256=l6PXrgCPZ_tmYKSEufoHfWBfCBzVuwcHXpbk3aYA7_w,55892
5
5
  rda_python_common/PgLock.py,sha256=12i84nsGBuifSyPnm8IR63LvHvRuVU573D5QKFlHdOI,22623
@@ -9,7 +9,7 @@ rda_python_common/PgSplit.py,sha256=SSg5_Qu5PqP44EkqebO-V_cErNcdE2QtORgFHQ7RqlQ,
9
9
  rda_python_common/PgUtil.py,sha256=OqESKCd72b9g8m8jwjPJhXDtPYlW6G8oSOhwChvz2Cg,48600
10
10
  rda_python_common/__init__.py,sha256=WTpasPcnTQMDxRbPXv6vTbQQv8bITdUSkZ_RfdyBtig,994
11
11
  rda_python_common/pg_cmd.py,sha256=PiQaAeb7l92LceqMwSzLpz9nD5pDRHJcEZxTDn-HeCs,33255
12
- rda_python_common/pg_dbi.py,sha256=DxteZzGLbyvM4yNWkWibv9QYaNheMNv4ybs01bVgoiQ,118959
12
+ rda_python_common/pg_dbi.py,sha256=73DAROFqQF1HDAVCX7t92gRrOnIFyGLpe8RPYLWDVgo,119524
13
13
  rda_python_common/pg_file.py,sha256=nwu1DTD6Pgi4yUFt_IJwvYvMbVMW1eEIf1N5EZjM1o8,162232
14
14
  rda_python_common/pg_lock.py,sha256=31EaVDjCkcx3-n8-KnzG18R8Pz7Z6KyFsEqcml6Iq5c,32702
15
15
  rda_python_common/pg_log.py,sha256=lzhjEL7FaGjHfl4cmlMuIZVAb5x0fSgiI8AShe0sAHw,82146
@@ -20,9 +20,9 @@ rda_python_common/pg_split.py,sha256=aAWKUZPmZ-LQ_fJ3DSKzPKxJw0fMDJ2fgP8ZT629M30
20
20
  rda_python_common/pg_util.py,sha256=3_-baqCI9j5bkC2Uw3hRJZtYwdr0FQC6mtgbeIhLwyQ,86045
21
21
  rda_python_common/pgpassword.py,sha256=aTQaO59QokWrv2EKom4TvKhNW2Mr6aFMMBVG4DCbcKI,5023
22
22
  rda_python_common/pgpassword.usg,sha256=Wrle6A8sdlMGx3ZEAmE6TNDPOlG84Whe0T3rCNFzPfY,2013
23
- rda_python_common-3.0.0.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
24
- rda_python_common-3.0.0.dist-info/METADATA,sha256=Gy2zqPkeWIe7dXTjv-sz62JbAXSCJGOyJM1HKjVS0hA,14528
25
- rda_python_common-3.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
26
- rda_python_common-3.0.0.dist-info/entry_points.txt,sha256=pZgVNWspcK-F1TbPav7C3C9NdeHDZMm_25fW9weix00,65
27
- rda_python_common-3.0.0.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
28
- rda_python_common-3.0.0.dist-info/RECORD,,
23
+ rda_python_common-3.0.1.dist-info/licenses/LICENSE,sha256=1dck4EAQwv8QweDWCXDx-4Or0S8YwiCstaso_H57Pno,1097
24
+ rda_python_common-3.0.1.dist-info/METADATA,sha256=9XS840t2_gpk-_vLq7tBcvuJReVMm6uj7eap97iBxgw,14528
25
+ rda_python_common-3.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
26
+ rda_python_common-3.0.1.dist-info/entry_points.txt,sha256=pZgVNWspcK-F1TbPav7C3C9NdeHDZMm_25fW9weix00,65
27
+ rda_python_common-3.0.1.dist-info/top_level.txt,sha256=KVQmx7D3DD-jsiheqL8HdTrRE14hpRnZY5_ioMArA5k,18
28
+ rda_python_common-3.0.1.dist-info/RECORD,,