structured-data-models-client 2.0.0__cp310-abi3-win_amd64.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.
Files changed (114) hide show
  1. sdm_client/__init__.py +128 -0
  2. sdm_client/_native.pyd +0 -0
  3. sdm_client/_native.pyi +152 -0
  4. sdm_client/_relbench.py +175 -0
  5. sdm_client/_rust/__init__.py +15 -0
  6. sdm_client/_rust/capabilities.py +42 -0
  7. sdm_client/_rust/codec.py +532 -0
  8. sdm_client/_rust/direct.py +883 -0
  9. sdm_client/_rust/direct_admission.py +205 -0
  10. sdm_client/_rust/direct_cells.py +223 -0
  11. sdm_client/_rust/direct_dtypes.py +130 -0
  12. sdm_client/_rust/direct_io.py +135 -0
  13. sdm_client/_rust/direct_options.py +106 -0
  14. sdm_client/_rust/direct_prediction.py +238 -0
  15. sdm_client/_rust/direct_response.py +632 -0
  16. sdm_client/_rust/direct_schema.py +532 -0
  17. sdm_client/_rust/edits.py +352 -0
  18. sdm_client/_rust/errors.py +821 -0
  19. sdm_client/_rust/examples.py +120 -0
  20. sdm_client/_rust/facts.py +161 -0
  21. sdm_client/_rust/frame_materialize.py +162 -0
  22. sdm_client/_rust/frame_schema.py +235 -0
  23. sdm_client/_rust/frame_sessions.py +225 -0
  24. sdm_client/_rust/host_providers.py +1130 -0
  25. sdm_client/_rust/labels.py +88 -0
  26. sdm_client/_rust/materialize.py +472 -0
  27. sdm_client/_rust/predict.py +686 -0
  28. sdm_client/_rust/providers/__init__.py +57 -0
  29. sdm_client/_rust/providers/databricks.py +258 -0
  30. sdm_client/_rust/providers/duckdb.py +64 -0
  31. sdm_client/_rust/providers/postgres.py +168 -0
  32. sdm_client/_rust/providers/postgres_arrow.py +346 -0
  33. sdm_client/_rust/providers/snowflake.py +152 -0
  34. sdm_client/_rust/providers/sqlite.py +81 -0
  35. sdm_client/_rust/rebind.py +57 -0
  36. sdm_client/_rust/refine.py +97 -0
  37. sdm_client/_rust/result_items.py +115 -0
  38. sdm_client/_rust/result_merge.py +265 -0
  39. sdm_client/_rust/results.py +950 -0
  40. sdm_client/_rust/run.py +608 -0
  41. sdm_client/_rust/s0.py +78 -0
  42. sdm_client/_rust/schema.py +256 -0
  43. sdm_client/_rust/sessions.py +440 -0
  44. sdm_client/_rust/spec.py +90 -0
  45. sdm_client/_rust/splits.py +58 -0
  46. sdm_client/_rust/sql_column.py +46 -0
  47. sdm_client/_rust/sql_kit.py +83 -0
  48. sdm_client/_rust/tabular_index.py +689 -0
  49. sdm_client/_rust/tabular_materialize.py +546 -0
  50. sdm_client/_rust/tabular_temporal.py +170 -0
  51. sdm_client/_version.py +5 -0
  52. sdm_client/_visualization.py +178 -0
  53. sdm_client/adapters/__init__.py +9 -0
  54. sdm_client/adapters/relational.py +311 -0
  55. sdm_client/adapters/tabular.py +127 -0
  56. sdm_client/assets/MERMAID_COMPONENTS.json +764 -0
  57. sdm_client/assets/MERMAID_LICENSE +21 -0
  58. sdm_client/assets/THIRD-PARTY-NOTICES-MERMAID.txt +891 -0
  59. sdm_client/assets/VENDORED.md +8 -0
  60. sdm_client/assets/mermaid.min.js +3405 -0
  61. sdm_client/assets/relbench/README.md +12 -0
  62. sdm_client/assets/relbench/overrides.json +74 -0
  63. sdm_client/assets/relbench/registry.json +1665 -0
  64. sdm_client/assets/schema.html +8 -0
  65. sdm_client/base.py +125 -0
  66. sdm_client/client.py +934 -0
  67. sdm_client/context_report.py +77 -0
  68. sdm_client/core/__init__.py +5 -0
  69. sdm_client/core/databricks_serving.py +695 -0
  70. sdm_client/core/databricks_user_agent.py +76 -0
  71. sdm_client/core/dates.py +278 -0
  72. sdm_client/core/transport.py +1002 -0
  73. sdm_client/core/warnings.py +51 -0
  74. sdm_client/decompose.py +203 -0
  75. sdm_client/errors.py +196 -0
  76. sdm_client/explanations.py +264 -0
  77. sdm_client/in_process/__init__.py +14 -0
  78. sdm_client/in_process/answers.py +137 -0
  79. sdm_client/in_process/backend.py +607 -0
  80. sdm_client/in_process/columns.py +298 -0
  81. sdm_client/in_process/gradients.py +135 -0
  82. sdm_client/in_process/relational.py +486 -0
  83. sdm_client/in_process/tables.py +106 -0
  84. sdm_client/in_process/tabular.py +141 -0
  85. sdm_client/inference.py +43 -0
  86. sdm_client/materializers/__init__.py +9 -0
  87. sdm_client/materializers/relational.py +100 -0
  88. sdm_client/materializers/sources.py +27 -0
  89. sdm_client/materializers/tabular.py +76 -0
  90. sdm_client/models.py +219 -0
  91. sdm_client/provider.py +1021 -0
  92. sdm_client/py.typed +0 -0
  93. sdm_client/query.py +835 -0
  94. sdm_client/relational_task.py +34 -0
  95. sdm_client/reports.py +358 -0
  96. sdm_client/request.py +1175 -0
  97. sdm_client/result.py +315 -0
  98. sdm_client/sanitization.py +56 -0
  99. sdm_client/schema.py +2696 -0
  100. sdm_client/sources.py +527 -0
  101. sdm_client/summaries.py +153 -0
  102. sdm_client/timeseries.py +176 -0
  103. sdm_client/wire/__init__.py +46 -0
  104. sdm_client/wire/answers.py +80 -0
  105. sdm_client/wire/dtypes.py +701 -0
  106. sdm_client/wire/keys.py +363 -0
  107. sdm_client/wire/tables.py +50 -0
  108. structured_data_models_client-2.0.0.dist-info/METADATA +108 -0
  109. structured_data_models_client-2.0.0.dist-info/RECORD +114 -0
  110. structured_data_models_client-2.0.0.dist-info/WHEEL +4 -0
  111. structured_data_models_client-2.0.0.dist-info/licenses/LICENSE +207 -0
  112. structured_data_models_client-2.0.0.dist-info/licenses/NOTICE +21 -0
  113. structured_data_models_client-2.0.0.dist-info/licenses/THIRD-PARTY-NOTICES-RUST.txt +5142 -0
  114. structured_data_models_client-2.0.0.dist-info/sboms/sdm-py.cyclonedx.json +6256 -0
sdm_client/__init__.py ADDED
@@ -0,0 +1,128 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
2
+ # All rights reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ r"""One Python client for NVIDIA's structured-data foundation models.
6
+
7
+ Structured-data foundation models predict in context: you give the model
8
+ labelled rows and the rows you want scored, and it answers in one pass. There
9
+ is no training loop and no per-dataset artifact.
10
+
11
+ >>> from sdm_client import Request, SDMClient, KumoTabular
12
+ >>> request = Request(context=labelled, predict=to_score,
13
+ ... target='churn', task='classification')
14
+ >>> with SDMClient(url='http://localhost:8000') as client:
15
+ ... print(client.predict(request, model=KumoTabular()).to_pandas())
16
+
17
+ The model is an argument, not a method name. A request is gathered for one
18
+ model and answered by that one: `materialize(model=...)` says which, and
19
+ defaults to what the schema's shape implies.
20
+ """
21
+
22
+ from sdm_client._version import __version__
23
+ from sdm_client.base import ModelCapabilities
24
+ from sdm_client.client import FittedModel, SDMClient
25
+ from sdm_client.context_report import ContextDraw, ContextReport
26
+ from sdm_client.core.warnings import SDMWarning
27
+ from sdm_client.errors import (
28
+ MissingExtraError,
29
+ NimRequestError,
30
+ StructuredDataError,
31
+ UnknownModelError,
32
+ UnsupportedRequestError,
33
+ )
34
+ from sdm_client.explanations import (
35
+ ColumnExplanations,
36
+ Explanations,
37
+ GradientExplanations,
38
+ )
39
+ from sdm_client.inference import InferenceConfig
40
+ from sdm_client.models import KumoRelational, KumoTabular, Model
41
+ from sdm_client.provider import Source
42
+ from sdm_client.query import PredictiveQuery
43
+ from sdm_client.relational_task import RelationalTask
44
+ from sdm_client.reports import (
45
+ ColumnMetadata,
46
+ ExplanationView,
47
+ FeatureImportance,
48
+ FeatureImportanceRow,
49
+ LinkMetadata,
50
+ LinkReport,
51
+ MetadataReport,
52
+ TableMetadata,
53
+ )
54
+ from sdm_client.request import Request, Split, Target, Task
55
+ from sdm_client.result import PredictionResult
56
+ from sdm_client.sanitization import SanitizationReport, TableSanitizationReport
57
+ from sdm_client.schema import (
58
+ Column,
59
+ Relationship,
60
+ RelationshipOrigin,
61
+ Schema,
62
+ SourceTable,
63
+ Table,
64
+ )
65
+ from sdm_client.sources import (
66
+ DatabricksSource,
67
+ DuckDBSource,
68
+ PostgresSource,
69
+ SnowflakeSource,
70
+ SQLiteSource,
71
+ )
72
+ from sdm_client.summaries import ExplanationSummarizer
73
+
74
+ __all__ = [
75
+ 'InferenceConfig',
76
+ 'ExplanationSummarizer',
77
+ 'RelationalTask',
78
+ 'ForecastInput',
79
+ 'build_timeseries',
80
+ 'ColumnMetadata',
81
+ 'TableMetadata',
82
+ 'MetadataReport',
83
+ 'LinkMetadata',
84
+ 'LinkReport',
85
+ 'ExplanationView',
86
+ 'FeatureImportance',
87
+ 'FeatureImportanceRow',
88
+ 'SDMWarning',
89
+ 'Column',
90
+ 'FittedModel',
91
+ 'KumoRelational',
92
+ 'KumoTabular',
93
+ 'MissingExtraError',
94
+ 'Model',
95
+ 'ModelCapabilities',
96
+ 'NimRequestError',
97
+ 'PredictionResult',
98
+ 'GradientExplanations',
99
+ 'ColumnExplanations',
100
+ 'Explanations',
101
+ 'PredictiveQuery',
102
+ 'Relationship',
103
+ 'RelationshipOrigin',
104
+ 'Request',
105
+ 'Schema',
106
+ 'ContextDraw',
107
+ 'ContextReport',
108
+ 'SanitizationReport',
109
+ 'TableSanitizationReport',
110
+ 'Split',
111
+ 'SDMClient',
112
+ 'Source',
113
+ 'SourceTable',
114
+ 'DatabricksSource',
115
+ 'DuckDBSource',
116
+ 'PostgresSource',
117
+ 'SQLiteSource',
118
+ 'SnowflakeSource',
119
+ 'StructuredDataError',
120
+ 'Table',
121
+ 'Target',
122
+ 'Task',
123
+ 'UnknownModelError',
124
+ 'UnsupportedRequestError',
125
+ '__version__',
126
+ ]
127
+
128
+ from sdm_client.timeseries import ForecastInput, build_timeseries
sdm_client/_native.pyd ADDED
Binary file
sdm_client/_native.pyi ADDED
@@ -0,0 +1,152 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
2
+ # All rights reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """The Rust core's binding, built from rust/bindings/sdm-py.
6
+
7
+ Control messages cross as ``bytes`` both ways, each with the attachments it
8
+ names in a ``dict`` by id. An attachment is ``bytes`` or Arrow data: in, any
9
+ object with ``__arrow_c_stream__``; out, an :class:`ArrowStream`. Only
10
+ ``sdm_client._rust`` imports this module, and only on a core route.
11
+ """
12
+
13
+ from collections.abc import Callable, Mapping
14
+ from typing import Literal, Protocol, final
15
+
16
+ #: The codes an error of the core carries, the contract's ``ErrorCode``, in
17
+ #: its order; each kind a code may carry is fixed in ``sdm-contract``
18
+ #: (``ErrorCode::kinds``).
19
+ _Code = Literal[
20
+ 'INVALID_REQUEST',
21
+ 'UNSUPPORTED_REQUEST',
22
+ 'INVALID_RESPONSE',
23
+ 'INVALID_CONFIGURATION',
24
+ 'TRANSPORT_ERROR',
25
+ 'INTERNAL_ERROR',
26
+ 'UNKNOWN_MODEL',
27
+ 'MISSING_EXTRA',
28
+ 'INVALID_SCHEMA',
29
+ 'SESSIONS_UNSUPPORTED',
30
+ 'UNSUPPORTED_TYPE',
31
+ 'VALUE_OUT_OF_RANGE',
32
+ 'PROVIDER_SCHEMA_MISMATCH',
33
+ 'PROVIDER_ERROR',
34
+ 'UNKNOWN_REPLY',
35
+ 'REPLY_MISSING',
36
+ 'WRONG_REPLY',
37
+ 'RUN_FINISHED',
38
+ 'RUN_CANCELLED',
39
+ 'RUN_POISONED',
40
+ 'RUN_BUSY',
41
+ 'INVALID_MESSAGE',
42
+ 'ENDPOINT_REFUSED',
43
+ ]
44
+ #: The kinds of an error of the core, the contract's ``ErrorKind``.
45
+ _Kind = Literal[
46
+ 'invalid_request',
47
+ 'unsupported',
48
+ 'not_found',
49
+ 'data_source',
50
+ 'model_endpoint',
51
+ 'cancelled',
52
+ 'protocol',
53
+ 'internal',
54
+ ]
55
+
56
+ #: The contract version this build speaks.
57
+ CONTRACT_VERSION: int
58
+ #: Whether this build has the test-only operations; the shipped wheel has not.
59
+ TEST_OPS: bool
60
+ #: The databases this build's core provides for, by name: the staging
61
+ #: rule's private, plain-data marker (contract/runners/run_python.py's
62
+ #: native provider admission), never public API.
63
+ PROVIDERS: tuple[str, ...]
64
+ #: Every code an error of the core may carry, in the contract's order.
65
+ ERROR_CODES: tuple[_Code, ...]
66
+ #: Each ``(stype, dtype)`` the language lets a column mean, by the
67
+ #: contract's names: the client's check of a meaning, read in place
68
+ #: of the old PQL package's.
69
+ MEANINGS: tuple[tuple[str, str], ...]
70
+ #: Each data type name a host may give a column, and the contract's name
71
+ #: of the type it names: the one table of them.
72
+ DTYPE_NAMES: tuple[tuple[str, str], ...]
73
+
74
+ class _ArrowStreamExportable(Protocol):
75
+ def __arrow_c_stream__(
76
+ self, requested_schema: object | None = None
77
+ ) -> object: ...
78
+
79
+ @final
80
+ class ArrowStream:
81
+ """Arrow data the core gave, exported through the PyCapsule interface."""
82
+
83
+ def __arrow_c_stream__(
84
+ self, requested_schema: object | None = None
85
+ ) -> object: ...
86
+ def __arrow_c_schema__(self) -> object: ...
87
+
88
+ #: An attachment a caller sends.
89
+ _AttachmentIn = bytes | _ArrowStreamExportable
90
+ #: An attachment the core gives.
91
+ _AttachmentOut = bytes | ArrowStream
92
+ #: A control message the core wrote, with the attachments it names.
93
+ _Outgoing = tuple[bytes, dict[int, _AttachmentOut]]
94
+
95
+ class CoreError(Exception):
96
+ """An error the core returned, as its ``error`` control message."""
97
+
98
+ kind: _Kind
99
+ code: _Code
100
+ #: Whether the same call may succeed if tried again; carried from
101
+ #: provider and transport errors, false otherwise.
102
+ retryable: bool
103
+ control: bytes
104
+ attachments: dict[int, _AttachmentOut]
105
+
106
+ @final
107
+ class Run:
108
+ """One core run. A call while another is in the run raises ``RUN_BUSY``."""
109
+
110
+ @staticmethod
111
+ def start(
112
+ message: bytes, attachments: Mapping[int, _AttachmentIn]
113
+ ) -> Run: ...
114
+ def next(self) -> _Outgoing: ...
115
+ def reply(
116
+ self, message: bytes, attachments: Mapping[int, _AttachmentIn]
117
+ ) -> None: ...
118
+ def cancel(self) -> None: ...
119
+ def take_attachment(self, id: int) -> _AttachmentOut | None: ...
120
+ def take_warnings(self) -> _Outgoing | None: ...
121
+ def take_sampler_state(self) -> _Outgoing | None: ...
122
+
123
+ @final
124
+ class SqlKit:
125
+ """A built-in source's SQL kit; one per run."""
126
+
127
+ def __init__(self, provider: bytes) -> None: ...
128
+ def capabilities(self) -> bytes: ...
129
+ def failure(self, error: bytes) -> bytes: ...
130
+ def answer(
131
+ self,
132
+ request: bytes,
133
+ keys: Mapping[int, _AttachmentIn],
134
+ run: Callable[[bytes, bytes, dict[int, ArrowStream]], object],
135
+ ) -> ArrowStream: ...
136
+
137
+ def reset_log_cache() -> None:
138
+ """Forget the logger levels the logging bridge cached."""
139
+
140
+ def templates() -> str:
141
+ """The table of what every error's and warning's sentence says, as
142
+ JSON."""
143
+
144
+ def is_posix_zone(text: str) -> bool:
145
+ """Whether a run takes ``text`` as a POSIX ``TZ`` local zone."""
146
+
147
+ def local_zone(setting: str | None, roots: list[str]) -> tuple[str, str] | None:
148
+ """The local zone by the core's rule: ``('iana', name)``,
149
+ ``('posix', text)`` or ``None``, from ``TZ`` and the lookup roots."""
150
+
151
+ def capabilities() -> str:
152
+ """Each model's capabilities, as the client describes them, as JSON."""
@@ -0,0 +1,175 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
2
+ # All rights reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Host-only pinned dataset I/O; schema and sampling policy stay in Rust."""
6
+
7
+ from __future__ import annotations
8
+
9
+ import hashlib
10
+ import json
11
+ import os
12
+ import re
13
+ import tempfile
14
+ from importlib.resources import files
15
+ from pathlib import Path
16
+ from typing import Any
17
+ from urllib.request import urlopen
18
+
19
+ from sdm_client.errors import StructuredDataError
20
+
21
+ _HUB = 'https://huggingface.co/datasets'
22
+
23
+
24
+ def _catalog() -> tuple[dict[str, Any], dict[str, Any]]:
25
+ root = files('sdm_client').joinpath('assets/relbench')
26
+ return (
27
+ json.loads(root.joinpath('registry.json').read_text()),
28
+ json.loads(root.joinpath('overrides.json').read_text()),
29
+ )
30
+
31
+
32
+ def _relative(repository: str, revision: str, dataset: str, table: str) -> Path:
33
+ parts = [
34
+ *repository.split('/'),
35
+ revision,
36
+ dataset,
37
+ 'db',
38
+ table + '.parquet',
39
+ ]
40
+ if len(repository.split('/')) != 2 or any(
41
+ not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9_.-]*', part) for part in parts
42
+ ):
43
+ raise StructuredDataError(
44
+ 'unsafe RelBench manifest path', code='INVALID_REQUEST'
45
+ )
46
+ return Path(*parts)
47
+
48
+
49
+ def _digest(path: Path) -> str:
50
+ digest = hashlib.sha256()
51
+ with path.open('rb') as stream:
52
+ for chunk in iter(lambda: stream.read(1024 * 1024), b''):
53
+ digest.update(chunk)
54
+ return digest.hexdigest()
55
+
56
+
57
+ def _fetch(path: Path, url: str, expected: str, offline: bool) -> None:
58
+ if path.is_file() and _digest(path) == expected:
59
+ return
60
+ if offline:
61
+ raise OSError(
62
+ 'offline cache entry is missing or has an invalid SHA-256'
63
+ )
64
+ path.parent.mkdir(parents=True, exist_ok=True)
65
+ temporary = None
66
+ try:
67
+ with tempfile.NamedTemporaryFile(
68
+ dir=path.parent, prefix='.' + path.name, delete=False
69
+ ) as output:
70
+ temporary = Path(output.name)
71
+ digest = hashlib.sha256()
72
+ with urlopen(url, timeout=60) as response:
73
+ for chunk in iter(lambda: response.read(1024 * 1024), b''):
74
+ output.write(chunk)
75
+ digest.update(chunk)
76
+ if digest.hexdigest() != expected:
77
+ raise OSError(
78
+ 'download SHA-256 does not match the pinned manifest'
79
+ )
80
+ os.replace(temporary, path)
81
+ finally:
82
+ if temporary is not None:
83
+ temporary.unlink(missing_ok=True)
84
+
85
+
86
+ def load(
87
+ cls: Any, name: str, *, cache_dir: str | Path | None, offline: bool
88
+ ) -> Any:
89
+ import pyarrow.parquet as parquet
90
+
91
+ from sdm_client.schema import Relationship
92
+
93
+ registry, overrides = _catalog()
94
+ if not isinstance(name, str) or not isinstance(offline, bool):
95
+ raise StructuredDataError(
96
+ 'RelBench name must be a string and offline a bool',
97
+ code='INVALID_REQUEST',
98
+ )
99
+ dataset = name.lower()
100
+ if dataset not in registry['datasets']:
101
+ dataset = 'rel-' + dataset
102
+ if dataset not in registry['datasets']:
103
+ raise StructuredDataError(
104
+ f'unknown RelBench dataset {name!r}; available: {", ".join(registry["datasets"])}',
105
+ code='INVALID_REQUEST',
106
+ )
107
+ try:
108
+ cache = (
109
+ Path(cache_dir).expanduser()
110
+ if cache_dir is not None
111
+ else Path.home() / '.cache/sdm/relbench'
112
+ )
113
+ except TypeError as error:
114
+ raise StructuredDataError(
115
+ 'cache_dir must be a filesystem path', code='INVALID_REQUEST'
116
+ ) from error
117
+ entry = registry['datasets'][dataset]
118
+ repository = entry['repository']
119
+ revision = registry['revisions'][repository]
120
+ frames = {}
121
+ for table, spec in entry['tables'].items():
122
+ relative = _relative(repository, revision, dataset, table)
123
+ path = cache / relative
124
+ try:
125
+ _fetch(
126
+ path,
127
+ f'{_HUB}/{repository}/resolve/{revision}/{dataset}/db/{table}.parquet',
128
+ spec['sha256'],
129
+ offline,
130
+ )
131
+ excluded = (
132
+ overrides.get(dataset, {}).get(table, {}).get('exclude', [])
133
+ )
134
+ columns = [
135
+ column
136
+ for column in parquet.read_schema(path).names
137
+ if column not in excluded
138
+ ]
139
+ frames[table] = parquet.read_table(
140
+ path, columns=columns
141
+ ).to_pandas()
142
+ except (OSError, ValueError) as error:
143
+ raise StructuredDataError(
144
+ f'could not load RelBench {dataset}.{table}: {error}',
145
+ code='PROVIDER_ERROR',
146
+ details={'dataset': dataset, 'table': table},
147
+ ) from error
148
+ links = [
149
+ Relationship(
150
+ table, column, target, entry['tables'][target]['primary_key']
151
+ )
152
+ for table, spec in entry['tables'].items()
153
+ for column, target in spec['foreign_keys'].items()
154
+ ]
155
+ schema = cls.from_data(
156
+ frames,
157
+ primary_keys={
158
+ table: spec['primary_key']
159
+ for table, spec in entry['tables'].items()
160
+ if spec['primary_key'] is not None
161
+ },
162
+ time_columns={
163
+ table: spec['time_column']
164
+ for table, spec in entry['tables'].items()
165
+ },
166
+ relationships=[],
167
+ )
168
+ for table, spec in entry['tables'].items():
169
+ if spec['primary_key'] is None:
170
+ schema[table].primary_key = None
171
+ schema.relationships = links
172
+ for table, declarations in overrides.get(dataset, {}).items():
173
+ for column, stype in declarations.get('stypes', {}).items():
174
+ schema[table][column].stype = stype
175
+ return schema
@@ -0,0 +1,15 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
2
+ # All rights reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Python value conversion, provider I/O and lifecycle adapters for Rust.
6
+
7
+ Importing this package does not load the native extension.
8
+ """
9
+
10
+
11
+ class NativeBoundaryError(RuntimeError):
12
+ """The native extension or a required host representation is unavailable.
13
+
14
+ This is a runtime integration failure, distinct from a rejected user request.
15
+ """
@@ -0,0 +1,42 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES.
2
+ # All rights reserved.
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ r"""Each model's capabilities on the core route: the core's table
6
+ (``sdm_host::capabilities``), the one table both hosts describe a model
7
+ from, which the Java host's ``SdmClient.capabilities`` reads too."""
8
+
9
+ from __future__ import annotations
10
+
11
+ import json
12
+
13
+ from sdm_client._rust.run import native
14
+ from sdm_client.base import ModelCapabilities
15
+ from sdm_client.errors import StructuredDataError
16
+
17
+
18
+ def described(model: str) -> ModelCapabilities:
19
+ r"""What the core's table says ``model`` supports, as
20
+ :class:`~sdm_client.base.ModelCapabilities`.
21
+
22
+ Raises:
23
+ StructuredDataError: The core's table names no such model, which
24
+ the client's registry named (``INTERNAL_ERROR``).
25
+ """
26
+ for each in json.loads(native().capabilities())['models']:
27
+ if each['model'] == model:
28
+ return ModelCapabilities(
29
+ model=each['model'],
30
+ tasks=tuple(each['tasks']),
31
+ outputs=tuple(each['outputs']),
32
+ single_table=each['single_table'],
33
+ multiple_tables=each['multiple_tables'],
34
+ relationships=each['relationships'],
35
+ explanation_formats=tuple(each['explanation_formats']),
36
+ sessions=each['sessions'],
37
+ source=each['source'],
38
+ )
39
+ raise StructuredDataError(
40
+ f"the core's table describes no model {model!r}",
41
+ code='INTERNAL_ERROR',
42
+ )