type-bridge 2.1.0__tar.gz → 2.2.0__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.
- {type_bridge-2.1.0 → type_bridge-2.2.0}/PKG-INFO +4 -4
- {type_bridge-2.1.0 → type_bridge-2.2.0}/pyproject.toml +8 -4
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/__init__.py +1 -1
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/_backend.py +1 -1
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/_runtime_projection.py +23 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/_rust_runtime.py +14 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/session.py +92 -28
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typedb_driver.py +4 -4
- {type_bridge-2.1.0 → type_bridge-2.2.0}/.gitignore +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/LICENSE +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/README.md +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/_rust.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/base.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/boolean.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/date.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/datetime.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/datetimetz.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/decimal.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/double.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/duration.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/flags.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/integer.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/numeric.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/attribute/string.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/coercion.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/aggregates.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/exceptions.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/formatting.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/has_lookup.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/hooks.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/lookup.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/patterns.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/role_lookup.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/role_players.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/rust_manager.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/strategies.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/typedb_manager.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/types.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/crud/utils.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/aggregate.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/arithmetic.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/base.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/boolean.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/builtin.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/comparison.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/functions.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/iid.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/role_player.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/string.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/expressions/utils.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/fields/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/fields/base.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/fields/role.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/__main__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_adoption_authority.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_adoption_import.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_archive_base.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_archive_imports.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_lower.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_operations.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/_ref.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/exceptions.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/introspection.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/loader.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/sidecar.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/snapshots.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/state.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/state_schema.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/migration/utils.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/base.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/entity.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/registry.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/relation.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/role.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/schema_scanner.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/models/utils.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/proxy.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/py.typed +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/query/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/query/ast.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/query/compiler.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/query/parser.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/query_v2.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/reserved_words.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/rules.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/_descriptors.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/_remote_terminal.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/_terminal.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/page.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/query.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/references.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/remote_limits.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/remote_query.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/remote_session.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/results.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typed/session.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typeql/__init__.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/typeql/annotations.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/validation.py +0 -0
- {type_bridge-2.1.0 → type_bridge-2.2.0}/type_bridge/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: type-bridge
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Typed Python, TypeScript, and Rust application tooling for TypeDB
|
|
5
5
|
Project-URL: Homepage, https://github.com/ds1sqe/type-bridge
|
|
6
6
|
Project-URL: Repository, https://github.com/ds1sqe/type-bridge
|
|
@@ -23,7 +23,7 @@ Requires-Python: <3.15,>=3.12
|
|
|
23
23
|
Requires-Dist: isodate==0.7.2
|
|
24
24
|
Requires-Dist: jinja2>=3.1.0
|
|
25
25
|
Requires-Dist: pydantic>=2.12.4
|
|
26
|
-
Requires-Dist: type-bridge-core==2.
|
|
26
|
+
Requires-Dist: type-bridge-core==2.2.0
|
|
27
27
|
Requires-Dist: typer>=0.15.0
|
|
28
28
|
Requires-Dist: typing-extensions>=4.12
|
|
29
29
|
Provides-Extra: dev
|
|
@@ -35,7 +35,7 @@ Requires-Dist: pytest-order>=1.2.0; extra == 'dev'
|
|
|
35
35
|
Requires-Dist: pytest>=9.0.1; extra == 'dev'
|
|
36
36
|
Requires-Dist: pyyaml>=6.0.3; extra == 'dev'
|
|
37
37
|
Requires-Dist: ruff==0.15.21; extra == 'dev'
|
|
38
|
-
Requires-Dist: typedb-driver==3.12.
|
|
38
|
+
Requires-Dist: typedb-driver==3.12.3; (python_version >= '3.14') and extra == 'dev'
|
|
39
39
|
Requires-Dist: typedb-driver~=3.11.5; (python_version < '3.14') and extra == 'dev'
|
|
40
40
|
Provides-Extra: docs
|
|
41
41
|
Requires-Dist: mkdocs-gen-files>=0.5; extra == 'docs'
|
|
@@ -46,7 +46,7 @@ Requires-Dist: mkdocs>=1.6; extra == 'docs'
|
|
|
46
46
|
Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
|
|
47
47
|
Provides-Extra: typedb-driver
|
|
48
48
|
Requires-Dist: typedb-driver<3.13,>=3.11; (python_version < '3.14') and extra == 'typedb-driver'
|
|
49
|
-
Requires-Dist: typedb-driver==3.12.
|
|
49
|
+
Requires-Dist: typedb-driver==3.12.3; (python_version >= '3.14') and extra == 'typedb-driver'
|
|
50
50
|
Description-Content-Type: text/markdown
|
|
51
51
|
|
|
52
52
|
<p align="center">
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "type-bridge"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
description = "Typed Python, TypeScript, and Rust application tooling for TypeDB"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12,<3.15"
|
|
@@ -30,7 +30,7 @@ dependencies = [
|
|
|
30
30
|
"jinja2>=3.1.0",
|
|
31
31
|
"typer>=0.15.0",
|
|
32
32
|
# The facade and native semantic engine are one release unit.
|
|
33
|
-
"type-bridge-core==2.
|
|
33
|
+
"type-bridge-core==2.2.0",
|
|
34
34
|
"typing-extensions>=4.12",
|
|
35
35
|
]
|
|
36
36
|
|
|
@@ -58,7 +58,7 @@ dev = [
|
|
|
58
58
|
# the embedded Rust runtime and serves TypeDB 3.11 and 3.12 on every
|
|
59
59
|
# supported interpreter.
|
|
60
60
|
"typedb-driver~=3.11.5; python_version < '3.14'",
|
|
61
|
-
"typedb-driver==3.12.
|
|
61
|
+
"typedb-driver==3.12.3; python_version >= '3.14'",
|
|
62
62
|
"pytest>=9.0.1",
|
|
63
63
|
"pytest-asyncio>=1.3.0",
|
|
64
64
|
"pytest-order>=1.2.0",
|
|
@@ -81,7 +81,7 @@ docs = [
|
|
|
81
81
|
]
|
|
82
82
|
typedb-driver = [
|
|
83
83
|
"typedb-driver>=3.11,<3.13; python_version < '3.14'",
|
|
84
|
-
"typedb-driver==3.12.
|
|
84
|
+
"typedb-driver==3.12.3; python_version >= '3.14'",
|
|
85
85
|
]
|
|
86
86
|
|
|
87
87
|
[tool.ty.environment]
|
|
@@ -165,6 +165,10 @@ precision = 2
|
|
|
165
165
|
[tool.coverage.html]
|
|
166
166
|
directory = "htmlcov"
|
|
167
167
|
|
|
168
|
+
[tool.uv]
|
|
169
|
+
# Keep mypy's wheel-only helper on a complete, verified release.
|
|
170
|
+
constraint-dependencies = ["ast-serialize==0.10.0"]
|
|
171
|
+
|
|
168
172
|
[tool.uv.workspace]
|
|
169
173
|
members = [
|
|
170
174
|
"type-bridge-core",
|
|
@@ -24,7 +24,7 @@ if TYPE_CHECKING:
|
|
|
24
24
|
from type_bridge.migration.exceptions import SchemaConflictError, SchemaValidationError
|
|
25
25
|
from type_bridge.migration.introspection import SchemaIntrospector
|
|
26
26
|
|
|
27
|
-
__version__ = "2.
|
|
27
|
+
__version__ = "2.2.0"
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
_LAZY_EXPORTS: dict[str, tuple[str, str]] = {
|
|
@@ -13,7 +13,7 @@ RUST_BACKEND = "rust"
|
|
|
13
13
|
def selected_backend() -> str:
|
|
14
14
|
"""Return the configured manager backend.
|
|
15
15
|
|
|
16
|
-
The Python ORM backend was retired in #125
|
|
16
|
+
The Python ORM backend was retired in #125. The environment
|
|
17
17
|
variable is retained only to reject stale transition settings clearly.
|
|
18
18
|
"""
|
|
19
19
|
value = os.environ.get(BACKEND_ENV_VAR, RUST_BACKEND).strip().lower()
|
|
@@ -44,6 +44,29 @@ def install_runtime_projection(
|
|
|
44
44
|
return installed
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
def install_runtime_projection_with_authority(
|
|
48
|
+
projection_json: str,
|
|
49
|
+
semantic_fingerprint_json: str,
|
|
50
|
+
projection_fingerprint_json: str,
|
|
51
|
+
models: Sequence[tuple[type[object], type[object] | None]],
|
|
52
|
+
schema_authority: bytes,
|
|
53
|
+
*,
|
|
54
|
+
structs: Sequence[type[object]] = (),
|
|
55
|
+
) -> PyRuntimeProjection:
|
|
56
|
+
"""Verify and install one ordered generated package with compiled authority."""
|
|
57
|
+
installed = rust_core().PyRuntimeProjection(
|
|
58
|
+
projection_json,
|
|
59
|
+
semantic_fingerprint_json,
|
|
60
|
+
projection_fingerprint_json,
|
|
61
|
+
list(models),
|
|
62
|
+
schema_authority,
|
|
63
|
+
list(structs),
|
|
64
|
+
)
|
|
65
|
+
for model, _reference in models:
|
|
66
|
+
_installed_projection_by_model[model] = installed
|
|
67
|
+
return installed
|
|
68
|
+
|
|
69
|
+
|
|
47
70
|
def _installed_projection_for(model: type[object]) -> PyRuntimeProjection:
|
|
48
71
|
try:
|
|
49
72
|
return _installed_projection_by_model[model]
|
|
@@ -531,6 +531,20 @@ def rust_database_for(connection: Any) -> PyRustDatabase:
|
|
|
531
531
|
return rust_db
|
|
532
532
|
|
|
533
533
|
|
|
534
|
+
def database_from_rust(
|
|
535
|
+
endpoint: str,
|
|
536
|
+
database_name: str,
|
|
537
|
+
rust_database: PyRustDatabase,
|
|
538
|
+
) -> Any:
|
|
539
|
+
"""Wrap one package-owned native database without reconnecting."""
|
|
540
|
+
from type_bridge.session import Database
|
|
541
|
+
|
|
542
|
+
database = Database(address=endpoint, database=database_name)
|
|
543
|
+
setattr(database, "_rust_backend_database", rust_database)
|
|
544
|
+
database._transport_committed = True
|
|
545
|
+
return database
|
|
546
|
+
|
|
547
|
+
|
|
534
548
|
def state_reader_for(connection: Any) -> Any:
|
|
535
549
|
"""Return the native read-only frozen-ledger reader."""
|
|
536
550
|
return rust_core().PyMigrationStateReader(rust_database_for(connection))
|
|
@@ -8,7 +8,7 @@ import threading
|
|
|
8
8
|
import warnings
|
|
9
9
|
from dataclasses import dataclass
|
|
10
10
|
from enum import Enum
|
|
11
|
-
from typing import TYPE_CHECKING, Any, cast, overload
|
|
11
|
+
from typing import TYPE_CHECKING, Any, Literal, cast, overload
|
|
12
12
|
|
|
13
13
|
import type_bridge.typedb_driver as typedb_driver
|
|
14
14
|
import type_bridge.version as version
|
|
@@ -637,45 +637,61 @@ class Database:
|
|
|
637
637
|
|
|
638
638
|
def create_database(self) -> None:
|
|
639
639
|
"""Create the database if it doesn't exist."""
|
|
640
|
+
self.create_database_outcome()
|
|
641
|
+
|
|
642
|
+
def create_database_outcome(self) -> Literal["created", "already_exists"]:
|
|
643
|
+
"""Create the bound database and return a race-normalized outcome."""
|
|
640
644
|
if self._driver is not None:
|
|
641
|
-
if
|
|
642
|
-
logger.debug(f"Creating database: {self.database_name}")
|
|
643
|
-
self.driver.databases.create(self.database_name)
|
|
644
|
-
logger.info(f"Database created: {self.database_name}")
|
|
645
|
-
else:
|
|
645
|
+
if self.driver.databases.contains(self.database_name):
|
|
646
646
|
logger.debug(f"Database already exists: {self.database_name}")
|
|
647
|
-
|
|
647
|
+
return "already_exists"
|
|
648
|
+
logger.debug(f"Creating database: {self.database_name}")
|
|
649
|
+
try:
|
|
650
|
+
self.driver.databases.create(self.database_name)
|
|
651
|
+
except Exception:
|
|
652
|
+
if self.driver.databases.contains(self.database_name):
|
|
653
|
+
return "already_exists"
|
|
654
|
+
raise
|
|
655
|
+
logger.info(f"Database created: {self.database_name}")
|
|
656
|
+
return "created"
|
|
648
657
|
|
|
649
658
|
from type_bridge._rust_runtime import rust_database_for
|
|
650
659
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
logger.debug(f"Database already exists: {self.database_name}")
|
|
660
|
+
outcome = cast(
|
|
661
|
+
Literal["created", "already_exists"],
|
|
662
|
+
rust_database_for(self).create_database_outcome(),
|
|
663
|
+
)
|
|
664
|
+
logger.debug(f"Database create outcome for '{self.database_name}': {outcome}")
|
|
665
|
+
return outcome
|
|
658
666
|
|
|
659
667
|
def delete_database(self) -> None:
|
|
660
668
|
"""Delete the database."""
|
|
669
|
+
self.delete_database_outcome()
|
|
670
|
+
|
|
671
|
+
def delete_database_outcome(self) -> Literal["deleted", "already_absent"]:
|
|
672
|
+
"""Delete the bound database and return a race-normalized outcome."""
|
|
661
673
|
if self._driver is not None:
|
|
662
|
-
if self.driver.databases.contains(self.database_name):
|
|
663
|
-
logger.debug(f"Deleting database: {self.database_name}")
|
|
664
|
-
self.driver.databases.get(self.database_name).delete()
|
|
665
|
-
logger.info(f"Database deleted: {self.database_name}")
|
|
666
|
-
else:
|
|
674
|
+
if not self.driver.databases.contains(self.database_name):
|
|
667
675
|
logger.debug(f"Database does not exist, skipping delete: {self.database_name}")
|
|
668
|
-
|
|
676
|
+
return "already_absent"
|
|
677
|
+
logger.debug(f"Deleting database: {self.database_name}")
|
|
678
|
+
try:
|
|
679
|
+
self.driver.databases.get(self.database_name).delete()
|
|
680
|
+
except Exception:
|
|
681
|
+
if not self.driver.databases.contains(self.database_name):
|
|
682
|
+
return "deleted"
|
|
683
|
+
raise
|
|
684
|
+
logger.info(f"Database deleted: {self.database_name}")
|
|
685
|
+
return "deleted"
|
|
669
686
|
|
|
670
687
|
from type_bridge._rust_runtime import rust_database_for
|
|
671
688
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
logger.debug(f"Database does not exist, skipping delete: {self.database_name}")
|
|
689
|
+
outcome = cast(
|
|
690
|
+
Literal["deleted", "already_absent"],
|
|
691
|
+
rust_database_for(self).delete_database_outcome(),
|
|
692
|
+
)
|
|
693
|
+
logger.debug(f"Database delete outcome for '{self.database_name}': {outcome}")
|
|
694
|
+
return outcome
|
|
679
695
|
|
|
680
696
|
def database_exists(self) -> bool:
|
|
681
697
|
"""Check if database exists."""
|
|
@@ -688,6 +704,54 @@ class Database:
|
|
|
688
704
|
logger.debug(f"Database exists check for '{self.database_name}': {exists}")
|
|
689
705
|
return exists
|
|
690
706
|
|
|
707
|
+
def inspect_database_pair(
|
|
708
|
+
self,
|
|
709
|
+
) -> Literal["absent", "standalone_managed", "owned_pair", "owned_journal_orphan"]:
|
|
710
|
+
"""Inspect the managed database and its package-owned journal as one pair."""
|
|
711
|
+
from type_bridge._rust_runtime import rust_database_for
|
|
712
|
+
|
|
713
|
+
return cast(
|
|
714
|
+
Literal["absent", "standalone_managed", "owned_pair", "owned_journal_orphan"],
|
|
715
|
+
rust_database_for(self).inspect_database_pair(),
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
def inspect_database_pair_controlled(
|
|
719
|
+
self,
|
|
720
|
+
*,
|
|
721
|
+
timeout_milliseconds: int | None = None,
|
|
722
|
+
cancellation: Any | None = None,
|
|
723
|
+
) -> Literal["absent", "standalone_managed", "owned_pair", "owned_journal_orphan"]:
|
|
724
|
+
"""Inspect the managed database pair under explicit execution controls."""
|
|
725
|
+
from type_bridge._rust_runtime import rust_database_for
|
|
726
|
+
|
|
727
|
+
return cast(
|
|
728
|
+
Literal["absent", "standalone_managed", "owned_pair", "owned_journal_orphan"],
|
|
729
|
+
rust_database_for(self).inspect_database_pair_controlled(
|
|
730
|
+
timeout_milliseconds=timeout_milliseconds,
|
|
731
|
+
cancellation=cancellation,
|
|
732
|
+
),
|
|
733
|
+
)
|
|
734
|
+
|
|
735
|
+
def plan_database_delete(self) -> Any:
|
|
736
|
+
"""Create a single-use, pair-aware managed database deletion plan."""
|
|
737
|
+
from type_bridge._rust_runtime import rust_database_for
|
|
738
|
+
|
|
739
|
+
return rust_database_for(self).plan_database_delete()
|
|
740
|
+
|
|
741
|
+
def plan_database_delete_controlled(
|
|
742
|
+
self,
|
|
743
|
+
*,
|
|
744
|
+
timeout_milliseconds: int | None = None,
|
|
745
|
+
cancellation: Any | None = None,
|
|
746
|
+
) -> Any:
|
|
747
|
+
"""Create a managed deletion plan under explicit execution controls."""
|
|
748
|
+
from type_bridge._rust_runtime import rust_database_for
|
|
749
|
+
|
|
750
|
+
return rust_database_for(self).plan_database_delete_controlled(
|
|
751
|
+
timeout_milliseconds=timeout_milliseconds,
|
|
752
|
+
cancellation=cancellation,
|
|
753
|
+
)
|
|
754
|
+
|
|
691
755
|
@overload
|
|
692
756
|
def transaction(self, transaction_type: Enum) -> TransactionContext: ...
|
|
693
757
|
|
|
@@ -747,7 +811,7 @@ class Database:
|
|
|
747
811
|
def detected_server_version(self) -> str | None:
|
|
748
812
|
"""The server version detected by the connect-time version gate.
|
|
749
813
|
|
|
750
|
-
Returns the version string (e.g. ``"3.12.
|
|
814
|
+
Returns the version string (e.g. ``"3.12.3"``) when known. ``None``
|
|
751
815
|
means the negotiated connection path produced no authoritative server
|
|
752
816
|
identity; supply ``server_version=`` at construction when strict
|
|
753
817
|
identity validation is required.
|
|
@@ -102,7 +102,7 @@ def _ensure_driver_interpreter_supported(installed: str) -> int | None:
|
|
|
102
102
|
raise _version.UnsupportedVersionError(
|
|
103
103
|
f"Installed typedb-driver {installed!r} has no compatible native wheel "
|
|
104
104
|
"for CPython 3.14. Install `type-bridge[typedb-driver]` "
|
|
105
|
-
"(driver 3.12.
|
|
105
|
+
"(driver 3.12.3) and target TypeDB 3.12."
|
|
106
106
|
)
|
|
107
107
|
return driver_band
|
|
108
108
|
|
|
@@ -166,7 +166,7 @@ def create_driver_options(
|
|
|
166
166
|
max_l = _version.max_supported_line()
|
|
167
167
|
if sys.version_info >= (3, 14):
|
|
168
168
|
remediation = (
|
|
169
|
-
"Install `type-bridge[typedb-driver]` (driver 3.12.
|
|
169
|
+
"Install `type-bridge[typedb-driver]` (driver 3.12.3 on "
|
|
170
170
|
"CPython 3.14) and target TypeDB 3.12."
|
|
171
171
|
)
|
|
172
172
|
else:
|
|
@@ -209,7 +209,7 @@ def embedded_driver_versions() -> dict[int, str]:
|
|
|
209
209
|
"""Return all driver versions compiled into the Rust runtime, keyed by band.
|
|
210
210
|
|
|
211
211
|
Delegates to ``type_bridge_core.embedded_driver_versions``. The default
|
|
212
|
-
build returns ``{8: "3.11.5", 9: "3.12.
|
|
212
|
+
build returns ``{8: "3.11.5", 9: "3.12.3"}``; a
|
|
213
213
|
single-band build returns only the one entry for its compiled band.
|
|
214
214
|
"""
|
|
215
215
|
return _core.embedded_driver_versions()
|
|
@@ -236,7 +236,7 @@ def server_version(
|
|
|
236
236
|
probe. The root path does not enable TLS implicitly.
|
|
237
237
|
|
|
238
238
|
Returns:
|
|
239
|
-
Version string reported by the server (e.g. ``"3.12.
|
|
239
|
+
Version string reported by the server (e.g. ``"3.12.3"``).
|
|
240
240
|
|
|
241
241
|
Raises:
|
|
242
242
|
type_bridge_core.VersionError: When the endpoint is unreachable or the
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|