turbo-lambda 0.9.0__tar.gz → 0.9.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: turbo-lambda
3
- Version: 0.9.0
3
+ Version: 0.9.2
4
4
  Summary: Turbo Lambda Description
5
5
  Author: Sam Mosleh
6
6
  Author-email: Sam Mosleh <sam.mosleh.d@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "turbo-lambda"
3
- version = "0.9.0"
3
+ version = "0.9.2"
4
4
  description = "Turbo Lambda Description"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Sam Mosleh", email = "sam.mosleh.d@gmail.com" }]
@@ -44,6 +44,20 @@ class RequestValidationError(GeneralError):
44
44
  )
45
45
 
46
46
 
47
+ class UnoptimizedQueryError(ApplicationError):
48
+ """Raised when a statement is planned using a sequential scan.
49
+
50
+ The detection is invisible to the interactor: every statement is planned
51
+ with ``EXPLAIN (FORMAT JSON)`` under the hood, so callers cannot tell that
52
+ the plan was inspected.
53
+ """
54
+
55
+ def __init__(self, query: str, plan: dict[str, Any]) -> None:
56
+ self.query = query
57
+ self.plan = plan
58
+ super().__init__(f"Unoptimized query uses a sequential scan: {query!r}")
59
+
60
+
47
61
  def general_error_to_gateway_response(
48
62
  error: GeneralError,
49
63
  ) -> schemas.ApiGatewaySerializedResponse:
@@ -5,6 +5,8 @@ from psycopg import pq, sql
5
5
  from psycopg.raw_cursor import RawCursorMixin
6
6
  from psycopg.rows import Row
7
7
 
8
+ from turbo_lambda.errors import UnoptimizedQueryError
9
+
8
10
  if TYPE_CHECKING:
9
11
  from collections.abc import Iterable
10
12
  from typing import Self
@@ -12,20 +14,6 @@ if TYPE_CHECKING:
12
14
  from psycopg.abc import Params, Query
13
15
 
14
16
 
15
- class UnoptimizedQueryError(Exception):
16
- """Raised when a statement is planned using a sequential scan.
17
-
18
- The detection is invisible to the interactor: every statement is planned
19
- with ``EXPLAIN (FORMAT JSON)`` under the hood, so callers cannot tell that
20
- the plan was inspected.
21
- """
22
-
23
- def __init__(self, query: str, plan: dict[str, Any]) -> None:
24
- self.query = query
25
- self.plan = plan
26
- super().__init__(f"Unoptimized query uses a sequential scan: {query!r}")
27
-
28
-
29
17
  _EXPLAINABLE_COMMAND_TAGS = frozenset({"SELECT", "INSERT", "UPDATE", "DELETE"})
30
18
 
31
19
 
File without changes