dominus-sdk-python-dev 2.1.6__py3-none-any.whl → 2.1.7__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.
@@ -1,72 +1,72 @@
1
- """
2
- Open Namespace - Direct database access operations.
3
-
4
- Provides DSN retrieval and raw SQL execution for advanced use cases.
5
- """
6
- from typing import Any, Dict, Optional, TYPE_CHECKING
7
-
8
- if TYPE_CHECKING:
9
- from ..start import Dominus
10
-
11
-
12
- class OpenNamespace:
13
- """
14
- Open database access namespace.
15
-
16
- Provides direct database connection info and raw SQL execution.
17
- Use with caution - bypasses most safety checks.
18
-
19
- Usage:
20
- # Get connection DSN
21
- dsn = await dominus.open.dsn()
22
-
23
- # Execute raw SQL
24
- result = await dominus.open.execute("SELECT * FROM public.users WHERE id = $1", {"1": user_id})
25
- """
26
-
27
- def __init__(self, client: "Dominus"):
28
- self._client = client
29
-
30
- async def dsn(self) -> str:
31
- """
32
- Get the PostgreSQL connection DSN.
33
-
34
- Returns the complete PostgreSQL connection URI that can be
35
- used directly by clients to connect to the database.
36
-
37
- Returns:
38
- PostgreSQL connection URI string
39
- """
40
- result = await self._client._request(
41
- endpoint="/api/scribe/open/dsn",
42
- method="GET"
43
- )
44
- if isinstance(result, dict):
45
- return result.get("dsn", result.get("connection_string", ""))
46
- return result
47
-
48
- async def execute(
49
- self,
50
- sql: str,
51
- params: Optional[Dict[str, Any]] = None
52
- ) -> Dict[str, Any]:
53
- """
54
- Execute raw SQL query.
55
-
56
- Use with caution - this bypasses most safety checks.
57
-
58
- Args:
59
- sql: SQL query string
60
- params: Optional parameter dictionary
61
-
62
- Returns:
63
- Query result
64
- """
65
- body = {"sql": sql}
66
- if params:
67
- body["params"] = params
68
-
69
- return await self._client._request(
70
- endpoint="/api/scribe/open/execute",
71
- body=body
72
- )
1
+ """
2
+ Open Namespace - Direct database access operations.
3
+
4
+ Provides DSN retrieval and raw SQL execution for advanced use cases.
5
+ """
6
+ from typing import Any, Dict, Optional, TYPE_CHECKING
7
+
8
+ if TYPE_CHECKING:
9
+ from ..start import Dominus
10
+
11
+
12
+ class OpenNamespace:
13
+ """
14
+ Open database access namespace.
15
+
16
+ Provides direct database connection info and raw SQL execution.
17
+ Use with caution - bypasses most safety checks.
18
+
19
+ Usage:
20
+ # Get connection DSN
21
+ dsn = await dominus.open.dsn()
22
+
23
+ # Execute raw SQL
24
+ result = await dominus.open.execute("SELECT * FROM public.users WHERE id = $1", {"1": user_id})
25
+ """
26
+
27
+ def __init__(self, client: "Dominus"):
28
+ self._client = client
29
+
30
+ async def dsn(self) -> str:
31
+ """
32
+ Get the PostgreSQL connection DSN.
33
+
34
+ Returns the complete PostgreSQL connection URI that can be
35
+ used directly by clients to connect to the database.
36
+
37
+ Returns:
38
+ PostgreSQL connection URI string
39
+ """
40
+ result = await self._client._request(
41
+ endpoint="/api/scribe/open/dsn",
42
+ method="GET"
43
+ )
44
+ if isinstance(result, dict):
45
+ return result.get("dsn", result.get("connection_string", ""))
46
+ return result
47
+
48
+ async def execute(
49
+ self,
50
+ sql: str,
51
+ params: Optional[Dict[str, Any]] = None
52
+ ) -> Dict[str, Any]:
53
+ """
54
+ Execute raw SQL query.
55
+
56
+ Use with caution - this bypasses most safety checks.
57
+
58
+ Args:
59
+ sql: SQL query string
60
+ params: Optional parameter dictionary
61
+
62
+ Returns:
63
+ Query result
64
+ """
65
+ body = {"sql": sql}
66
+ if params:
67
+ body["params"] = params
68
+
69
+ return await self._client._request(
70
+ endpoint="/api/scribe/open/execute",
71
+ body=body
72
+ )