55
66 1. declare a schema and a table on the database's default catalog connection,
77 2. upload a small parquet file,
8- 3. load it into the table (load_managed_table),
9- 4. read get_table_profile,
10- 5. refresh the catalog metadata,
11- 6. purge_table_cache,
12- 7. delete the managed table.
8+ 3. load it into the table (load_managed_table) and verify the load response,
9+ 4. delete the managed table.
10+
11+ Notes on managed-catalog semantics (all confirmed against prod). A managed
12+ catalog rejects the maintenance ops that apply to external catalogs, so this
13+ scenario deliberately omits them:
14+
15+ * No `refresh` step — rejected with 400 on a managed catalog ("use the loads
16+ endpoint to update its data"); `load_managed_table` is itself the load.
17+ * No `purge_table_cache` step — rejected with 400 ("purge not supported for
18+ managed catalogs").
19+ * No `get_table_profile` step — the profile is not populated within a usable
20+ window after a load, and no API call (refresh and purge are rejected; there
21+ is no profile-build/scan endpoint) triggers it. The load is verified via the
22+ `load_managed_table` response (row_count etc.), not a profile read.
1323
1424The scratch_database fixture tears the database (and its catalog) down, so the
15- test touches no seeded data. Skipped if pyarrow is unavailable (needed to author
16- the parquet payload).
25+ test touches no seeded data. pyarrow is a hard test dependency (see
26+ test-requirements.txt) and is imported directly — a missing pyarrow must fail
27+ loudly, never silently skip this scenario in CI.
1728"""
1829
1930from __future__ import annotations
2031
2132import io
2233
23- import pytest
24-
25- pa = pytest .importorskip ("pyarrow" )
26- pq = pytest .importorskip ("pyarrow.parquet" )
34+ import pyarrow as pa
35+ import pyarrow .parquet as pq
2736
2837from hotdata .api .connections_api import ConnectionsApi
2938from hotdata .api .databases_api import DatabasesApi
30- from hotdata .api .refresh_api import RefreshApi
3139from hotdata .api .uploads_api import UploadsApi
3240from hotdata .models .add_managed_schema_request import AddManagedSchemaRequest
3341from hotdata .models .add_managed_table_request import AddManagedTableRequest
3442from hotdata .models .load_managed_table_request import LoadManagedTableRequest
35- from hotdata .models .refresh_request import RefreshRequest
3643
3744
3845def _parquet_bytes () -> bytes :
@@ -46,7 +53,6 @@ def test_managed_tables_lifecycle(
4653 databases_api : DatabasesApi ,
4754 connections_api : ConnectionsApi ,
4855 uploads_api : UploadsApi ,
49- refresh_api : RefreshApi ,
5056 scratch_database : str ,
5157) -> None :
5258 # The database's auto-provisioned default catalog is a managed catalog,
@@ -77,15 +83,5 @@ def test_managed_tables_lifecycle(
7783 assert loaded .table_name == table_name
7884 assert loaded .row_count == 3
7985
80- profile = connections_api .get_table_profile (connection_id , schema_name , table_name )
81- assert profile .var_schema == schema_name
82- assert profile .table == table_name
83- assert profile .row_count == 3
84-
85- # Refresh the catalog metadata for the managed connection.
86- refreshed = refresh_api .refresh (RefreshRequest (connection_id = connection_id ))
87- assert refreshed .actual_instance is not None
88-
89- # purge_table_cache and delete_managed_table both return None on success.
90- connections_api .purge_table_cache (connection_id , schema_name , table_name )
86+ # delete_managed_table returns None on success.
9187 connections_api .delete_managed_table (connection_id , schema_name , table_name )
0 commit comments