opteryx-sqlalchemy 0.0.2__tar.gz → 0.0.4__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.
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opteryx-sqlalchemy
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Opteryx SQLAlchemy Dialect
5
- Requires-Python: >=3.11
5
+ Requires-Python: >=3.9
6
6
  License-File: LICENSE
7
7
  Requires-Dist: brotli-asgi>=1.6.0
8
8
  Requires-Dist: python-jose[cryptography]>=3.3.0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opteryx-sqlalchemy
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Opteryx SQLAlchemy Dialect
5
- Requires-Python: >=3.11
5
+ Requires-Python: >=3.9
6
6
  License-File: LICENSE
7
7
  Requires-Dist: brotli-asgi>=1.6.0
8
8
  Requires-Dist: python-jose[cryptography]>=3.3.0
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "opteryx-sqlalchemy"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  description = "Opteryx SQLAlchemy Dialect"
9
- requires-python = ">=3.11"
9
+ requires-python = ">=3.9"
10
10
  dependencies = [
11
11
  "brotli-asgi>=1.6.0",
12
12
  "python-jose[cryptography]>=3.3.0",
@@ -580,6 +580,13 @@ class Connection:
580
580
  return response.json()
581
581
  except requests.exceptions.HTTPError as e:
582
582
  if e.response is not None:
583
+ # Authentication/authorization errors should raise OperationalError
584
+ if e.response.status_code in (401, 403):
585
+ try:
586
+ detail = e.response.json().get("detail", str(e))
587
+ except (ValueError, json.JSONDecodeError):
588
+ detail = e.response.text or str(e)
589
+ raise OperationalError(f"Authentication error: {detail}") from e
583
590
  try:
584
591
  detail = e.response.json().get("detail", str(e))
585
592
  except (ValueError, json.JSONDecodeError):
@@ -600,8 +607,21 @@ class Connection:
600
607
  response.raise_for_status()
601
608
  return response.json()
602
609
  except requests.exceptions.HTTPError as e:
603
- if e.response is not None and e.response.status_code == 404:
604
- raise ProgrammingError("Statement not found") from e
610
+ if e.response is not None:
611
+ # Authentication/authorization errors should raise OperationalError
612
+ if e.response.status_code in (401, 403):
613
+ try:
614
+ detail = e.response.json().get("detail", str(e))
615
+ except (ValueError, json.JSONDecodeError):
616
+ detail = e.response.text or str(e)
617
+ raise OperationalError(f"Authentication error: {detail}") from e
618
+ if e.response.status_code == 404:
619
+ raise ProgrammingError("Statement not found") from e
620
+ try:
621
+ detail = e.response.json().get("detail", str(e))
622
+ except (ValueError, json.JSONDecodeError):
623
+ detail = e.response.text or str(e)
624
+ raise DatabaseError(f"HTTP error: {detail}") from e
605
625
  raise DatabaseError(f"HTTP error: {e}") from e
606
626
  except requests.exceptions.RequestException as e:
607
627
  raise OperationalError(f"Connection error: {e}") from e
@@ -647,6 +667,16 @@ class Connection:
647
667
  result = {"data": rows, "columns": [{"name": col} for col in (columns or [])]}
648
668
 
649
669
  return result
670
+ except requests.exceptions.HTTPError as e:
671
+ if e.response is not None:
672
+ # Authentication/authorization errors should raise OperationalError
673
+ if e.response.status_code in (401, 403):
674
+ try:
675
+ detail = e.response.json().get("detail", str(e))
676
+ except (ValueError, json.JSONDecodeError):
677
+ detail = e.response.text or str(e)
678
+ raise OperationalError(f"Authentication error: {detail}") from e
679
+ # For other HTTP errors, fall back to status endpoint
650
680
  except requests.exceptions.RequestException:
651
681
  pass
652
682