Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/hub/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Access with `norbix.hub.database`.
| `get_database_merged_term_tree` | `GET` | `/{version}/database/taxonomies/{TaxonomyName}/merged-tree` | `project` |
| `get_database_taxonomy_term_tree` | `GET` | `/{version}/database/taxonomies/{TaxonomyName}/terms/tree` | `project` |
| `apply_database_schema_bundle` | `POST` | `/{version}/database/schemas/apply-bundle` | `project` |
| `get_database_schema_index_status` | `GET` | `/{version}/database/schemas/{Id}/index-status` | `project` |
| `get_database_schema_list_settings` | `GET` | `/{version}/database/schemas/{Id}/list-settings` | `project` |
| `update_database_schema_list_settings` | `PUT` | `/{version}/database/schemas/{Id}/list-settings` | `project` |
| `update_database_schema_embed` | `PUT` | `/{version}/database/schemas/{Id}/embed` | `project` |
Expand Down Expand Up @@ -277,6 +278,7 @@ The request fields are listed under `RequestImportUploadUrlRequest`,
terms of `services` are the roots, and the terms of its child taxonomies nest
under them.
- `get_database_schema_list_settings(id)` / `update_database_schema_list_settings(id, settings={...})`
- `get_database_schema_index_status(id)` — the last schema-index run (Norbix creates `idx_<field>` per reference, `uniq_<field>` per unique field and `idx_<field>__id` for the default sort, at most 8): `status.state` is `building`, `ready`, `refused` or `partial`, with one entry per database under `status.integrations`
— how the record list shows a schema (the update replaces the whole settings object).
Each environment keeps its own list layout: the client's `env` (the
`norbix-env` header) picks which one you read and write.
Expand Down
26 changes: 26 additions & 0 deletions src/norbix_python/hub/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,19 @@ def apply_database_schema_bundle(self, *, timeout: float | None = None, bearer_t
bearer_token=bearer_token,
)

def get_database_schema_index_status(self, id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""GET /{version}/database/schemas/{Id}/index-status — the last schema-index run of the collection (state building | ready | refused | partial, per database)."""
return self._transport.send(
target="hub",
path="/{version}/database/schemas/{Id}/index-status",
method="GET",
path_params={"Id": id},
request=request,
scope="project",
timeout=timeout,
bearer_token=bearer_token,
)

def get_database_schema_list_settings(self, id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""GET /{version}/database/schemas/{Id}/list-settings"""
return self._transport.send(
Expand Down Expand Up @@ -1665,6 +1678,19 @@ async def apply_database_schema_bundle(self, *, timeout: float | None = None, be
bearer_token=bearer_token,
)

async def get_database_schema_index_status(self, id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""GET /{version}/database/schemas/{Id}/index-status — the last schema-index run of the collection (state building | ready | refused | partial, per database)."""
return await self._transport.send(
target="hub",
path="/{version}/database/schemas/{Id}/index-status",
method="GET",
path_params={"Id": id},
request=request,
scope="project",
timeout=timeout,
bearer_token=bearer_token,
)

async def get_database_schema_list_settings(self, id: str, *, timeout: float | None = None, bearer_token: str | None = None, **request: Any) -> Any:
"""GET /{version}/database/schemas/{Id}/list-settings"""
return await self._transport.send(
Expand Down
7 changes: 4 additions & 3 deletions tests/hub/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ def test_hub_database_reveal_managed_flex_connection_string_request_shape() -> N
("get_database_taxonomy_term_tree", "GET", f"{DB}/taxonomies/{TAX}/terms/tree", lambda m: m.get_database_taxonomy_term_tree(TAX)),
# schemas
("apply_database_schema_bundle", "POST", f"{DB}/schemas/apply-bundle", lambda m: m.apply_database_schema_bundle()),
("get_database_schema_index_status", "GET", f"{DB}/schemas/{SCHEMA}/index-status", lambda m: m.get_database_schema_index_status(SCHEMA)),
("get_database_schema_list_settings", "GET", f"{DB}/schemas/{SCHEMA}/list-settings", lambda m: m.get_database_schema_list_settings(SCHEMA)),
("update_database_schema_list_settings", "PUT", f"{DB}/schemas/{SCHEMA}/list-settings", lambda m: m.update_database_schema_list_settings(SCHEMA)),
("update_database_schema_embed", "PUT", f"{DB}/schemas/{SCHEMA}/embed", lambda m: m.update_database_schema_embed(SCHEMA)),
Expand Down Expand Up @@ -447,9 +448,9 @@ def test_hub_database_audit_method_hits_the_gateway_route(


def test_hub_database_audit_surface_size() -> None:
"""23 Hub database routes were missing before the audit; all of them are covered here."""
assert len(HUB_DB_AUDIT_CASES) == 23
assert len({case[0] for case in HUB_DB_AUDIT_CASES}) == 23
"""23 Hub database routes were missing before the audit, plus the schema index status (campaign 24 mongo-indexes); all of them are covered here."""
assert len(HUB_DB_AUDIT_CASES) == 24
assert len({case[0] for case in HUB_DB_AUDIT_CASES}) == 24


def test_hub_database_find_records_sends_query_values() -> None:
Expand Down
Loading