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
22 changes: 4 additions & 18 deletions src/dataherald/resources/table_descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ def list(
def sync_schemas(
self,
*,
db_connection_id: str,
table_names: List[str] | NotGiven = NOT_GIVEN,
body: List[table_description_sync_schemas_params.Body],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -187,13 +186,7 @@ def sync_schemas(
"""
return self._post(
"/api/table-descriptions/sync-schemas",
body=maybe_transform(
{
"db_connection_id": db_connection_id,
"table_names": table_names,
},
table_description_sync_schemas_params.TableDescriptionSyncSchemasParams,
),
body=maybe_transform(body, table_description_sync_schemas_params.TableDescriptionSyncSchemasParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -334,8 +327,7 @@ async def list(
async def sync_schemas(
self,
*,
db_connection_id: str,
table_names: List[str] | NotGiven = NOT_GIVEN,
body: List[table_description_sync_schemas_params.Body],
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -357,13 +349,7 @@ async def sync_schemas(
"""
return await self._post(
"/api/table-descriptions/sync-schemas",
body=maybe_transform(
{
"db_connection_id": db_connection_id,
"table_names": table_names,
},
table_description_sync_schemas_params.TableDescriptionSyncSchemasParams,
),
body=maybe_transform(body, table_description_sync_schemas_params.TableDescriptionSyncSchemasParams),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
from typing import List
from typing_extensions import Required, TypedDict

__all__ = ["TableDescriptionSyncSchemasParams"]
__all__ = ["TableDescriptionSyncSchemasParams", "Body"]


class TableDescriptionSyncSchemasParams(TypedDict, total=False):
body: Required[List[Body]]


class Body(TypedDict, total=False):
db_connection_id: Required[str]

table_names: List[str]
28 changes: 6 additions & 22 deletions tests/api_resources/test_table_descriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,14 @@ def test_streaming_response_list(self, client: Dataherald) -> None:
@parametrize
def test_method_sync_schemas(self, client: Dataherald) -> None:
table_description = client.table_descriptions.sync_schemas(
db_connection_id="string",
)
assert_matches_type(TableDescriptionSyncSchemasResponse, table_description, path=["response"])

@parametrize
def test_method_sync_schemas_with_all_params(self, client: Dataherald) -> None:
table_description = client.table_descriptions.sync_schemas(
db_connection_id="string",
table_names=["string", "string", "string"],
body=[{"db_connection_id": "string"}, {"db_connection_id": "string"}, {"db_connection_id": "string"}],
)
assert_matches_type(TableDescriptionSyncSchemasResponse, table_description, path=["response"])

@parametrize
def test_raw_response_sync_schemas(self, client: Dataherald) -> None:
response = client.table_descriptions.with_raw_response.sync_schemas(
db_connection_id="string",
body=[{"db_connection_id": "string"}, {"db_connection_id": "string"}, {"db_connection_id": "string"}],
)

assert response.is_closed is True
Expand All @@ -204,7 +196,7 @@ def test_raw_response_sync_schemas(self, client: Dataherald) -> None:
@parametrize
def test_streaming_response_sync_schemas(self, client: Dataherald) -> None:
with client.table_descriptions.with_streaming_response.sync_schemas(
db_connection_id="string",
body=[{"db_connection_id": "string"}, {"db_connection_id": "string"}, {"db_connection_id": "string"}],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down Expand Up @@ -375,22 +367,14 @@ async def test_streaming_response_list(self, async_client: AsyncDataherald) -> N
@parametrize
async def test_method_sync_schemas(self, async_client: AsyncDataherald) -> None:
table_description = await async_client.table_descriptions.sync_schemas(
db_connection_id="string",
)
assert_matches_type(TableDescriptionSyncSchemasResponse, table_description, path=["response"])

@parametrize
async def test_method_sync_schemas_with_all_params(self, async_client: AsyncDataherald) -> None:
table_description = await async_client.table_descriptions.sync_schemas(
db_connection_id="string",
table_names=["string", "string", "string"],
body=[{"db_connection_id": "string"}, {"db_connection_id": "string"}, {"db_connection_id": "string"}],
)
assert_matches_type(TableDescriptionSyncSchemasResponse, table_description, path=["response"])

@parametrize
async def test_raw_response_sync_schemas(self, async_client: AsyncDataherald) -> None:
response = await async_client.table_descriptions.with_raw_response.sync_schemas(
db_connection_id="string",
body=[{"db_connection_id": "string"}, {"db_connection_id": "string"}, {"db_connection_id": "string"}],
)

assert response.is_closed is True
Expand All @@ -401,7 +385,7 @@ async def test_raw_response_sync_schemas(self, async_client: AsyncDataherald) ->
@parametrize
async def test_streaming_response_sync_schemas(self, async_client: AsyncDataherald) -> None:
async with async_client.table_descriptions.with_streaming_response.sync_schemas(
db_connection_id="string",
body=[{"db_connection_id": "string"}, {"db_connection_id": "string"}, {"db_connection_id": "string"}],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down