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
85 changes: 7 additions & 78 deletions cirro_api_client/v1/api/dashboards/delete_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from ... import errors
from ...client import Client
from ...models.dashboard import Dashboard
from ...types import Response


Expand All @@ -25,16 +24,14 @@ def _get_kwargs(
return _kwargs


def _parse_response(*, client: Client, response: httpx.Response) -> Dashboard | None:
def _parse_response(*, client: Client, response: httpx.Response) -> Any | None:
if response.status_code == 204:
response_204 = Dashboard.from_dict(response.json())

return response_204
return None

errors.handle_error_response(response, client.raise_on_unexpected_status)


def _build_response(*, client: Client, response: httpx.Response) -> Response[Dashboard]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -48,7 +45,7 @@ def sync_detailed(
dashboard_id: str,
*,
client: Client,
) -> Response[Dashboard]:
) -> Response[Any]:
"""Delete dashboard

Deletes a dashboard
Expand All @@ -63,7 +60,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Dashboard]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -79,45 +76,12 @@ def sync_detailed(
return _build_response(client=client, response=response)


def sync(
project_id: str,
dashboard_id: str,
*,
client: Client,
) -> Dashboard | None:
"""Delete dashboard

Deletes a dashboard

Args:
project_id (str):
dashboard_id (str):
client (Client): instance of the API client

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Dashboard
"""

try:
return sync_detailed(
project_id=project_id,
dashboard_id=dashboard_id,
client=client,
).parsed
except errors.NotFoundException:
return None


async def asyncio_detailed(
project_id: str,
dashboard_id: str,
*,
client: Client,
) -> Response[Dashboard]:
) -> Response[Any]:
"""Delete dashboard

Deletes a dashboard
Expand All @@ -132,7 +96,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Response[Dashboard]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -143,38 +107,3 @@ async def asyncio_detailed(
response = await client.get_async_httpx_client().request(auth=client.get_auth(), **kwargs)

return _build_response(client=client, response=response)


async def asyncio(
project_id: str,
dashboard_id: str,
*,
client: Client,
) -> Dashboard | None:
"""Delete dashboard

Deletes a dashboard

Args:
project_id (str):
dashboard_id (str):
client (Client): instance of the API client

Raises:
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
httpx.TimeoutException: If the request takes longer than Client.timeout.

Returns:
Dashboard
"""

try:
return (
await asyncio_detailed(
project_id=project_id,
dashboard_id=dashboard_id,
client=client,
)
).parsed
except errors.NotFoundException:
return None
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ def sync_detailed(
client: Client,
body: SheetQueryRequest,
) -> Response[SheetQueryResponse]:
"""Run raw SQL against the project's sheets.
"""Run a raw SQL query against the project's sheets

Returns executed SQL results.
Runs a read-only SQL query and returns a page of its results. Unqualified table names resolve across
every namespace in the project.

Args:
project_id (str):
Expand Down Expand Up @@ -93,9 +94,10 @@ def sync(
client: Client,
body: SheetQueryRequest,
) -> SheetQueryResponse | None:
"""Run raw SQL against the project's sheets.
"""Run a raw SQL query against the project's sheets

Returns executed SQL results.
Runs a read-only SQL query and returns a page of its results. Unqualified table names resolve across
every namespace in the project.

Args:
project_id (str):
Expand Down Expand Up @@ -126,9 +128,10 @@ async def asyncio_detailed(
client: Client,
body: SheetQueryRequest,
) -> Response[SheetQueryResponse]:
"""Run raw SQL against the project's sheets.
"""Run a raw SQL query against the project's sheets

Returns executed SQL results.
Runs a read-only SQL query and returns a page of its results. Unqualified table names resolve across
every namespace in the project.

Args:
project_id (str):
Expand Down Expand Up @@ -159,9 +162,10 @@ async def asyncio(
client: Client,
body: SheetQueryRequest,
) -> SheetQueryResponse | None:
"""Run raw SQL against the project's sheets.
"""Run a raw SQL query against the project's sheets

Returns executed SQL results.
Runs a read-only SQL query and returns a page of its results. Unqualified table names resolve across
every namespace in the project.

Args:
project_id (str):
Expand Down
3 changes: 2 additions & 1 deletion cirro_api_client/v1/models/file_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class FileDef:
"""
Attributes:
file_type (FileType):
storage_uri (str): Full S3 URI to the source file.
storage_uri (str): Full S3 URI to the source file. For an ingest, it must be under the sheet's staging upload
path.
"""

file_type: FileType
Expand Down
20 changes: 20 additions & 0 deletions cirro_api_client/v1/models/run_analysis_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class RunAnalysisRequest:
environment_type (EnvironmentType | None | Unset): The type of execution environment to run the workflow in, if
not specified, the default for the pipeline is used
tags (list[Tag] | None | Unset): List of tags to apply to the dataset
disable_cache (bool | None | Unset): Disables the task run cache Default: False.
"""

name: str
Expand All @@ -58,6 +59,7 @@ class RunAnalysisRequest:
compute_environment_id: None | str | Unset = UNSET
environment_type: EnvironmentType | None | Unset = UNSET
tags: list[Tag] | None | Unset = UNSET
disable_cache: bool | None | Unset = False
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> dict[str, Any]:
Expand Down Expand Up @@ -137,6 +139,12 @@ def to_dict(self) -> dict[str, Any]:
else:
tags = self.tags

disable_cache: bool | None | Unset
if isinstance(self.disable_cache, Unset):
disable_cache = UNSET
else:
disable_cache = self.disable_cache

field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
Expand Down Expand Up @@ -164,6 +172,8 @@ def to_dict(self) -> dict[str, Any]:
field_dict["environmentType"] = environment_type
if tags is not UNSET:
field_dict["tags"] = tags
if disable_cache is not UNSET:
field_dict["disableCache"] = disable_cache

return field_dict

Expand Down Expand Up @@ -302,6 +312,15 @@ def _parse_tags(data: object) -> list[Tag] | None | Unset:

tags = _parse_tags(d.pop("tags", UNSET))

def _parse_disable_cache(data: object) -> bool | None | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(bool | None | Unset, data)

disable_cache = _parse_disable_cache(d.pop("disableCache", UNSET))

run_analysis_request = cls(
name=name,
process_id=process_id,
Expand All @@ -316,6 +335,7 @@ def _parse_tags(data: object) -> list[Tag] | None | Unset:
compute_environment_id=compute_environment_id,
environment_type=environment_type,
tags=tags,
disable_cache=disable_cache,
)

run_analysis_request.additional_properties = d
Expand Down
23 changes: 1 addition & 22 deletions cirro_api_client/v1/models/sheet_query_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,20 @@
class SheetQueryRequest:
"""
Attributes:
query (str): Raw SQL query to run.
namespace_name (None | str | Unset): Deprecated: no longer scopes name resolution — every namespace is on the
engine's search path. Example: default.
query (str): Raw SQL query to run. Unqualified table names resolve across every namespace in the project.
limit (int | None | Unset): Maximum rows to return. Responses also have a size limit: with wide rows a large
page can fail with a 502 — lower the limit if so. Default: 1000.
page (int | None | Unset): Page to return Default: 1.
"""

query: str
namespace_name: None | str | Unset = UNSET
limit: int | None | Unset = 1000
page: int | None | Unset = 1
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> dict[str, Any]:
query = self.query

namespace_name: None | str | Unset
if isinstance(self.namespace_name, Unset):
namespace_name = UNSET
else:
namespace_name = self.namespace_name

limit: int | None | Unset
if isinstance(self.limit, Unset):
limit = UNSET
Expand All @@ -57,8 +48,6 @@ def to_dict(self) -> dict[str, Any]:
"query": query,
}
)
if namespace_name is not UNSET:
field_dict["namespaceName"] = namespace_name
if limit is not UNSET:
field_dict["limit"] = limit
if page is not UNSET:
Expand All @@ -71,15 +60,6 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
query = d.pop("query")

def _parse_namespace_name(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)

namespace_name = _parse_namespace_name(d.pop("namespaceName", UNSET))

def _parse_limit(data: object) -> int | None | Unset:
if data is None:
return data
Expand All @@ -100,7 +80,6 @@ def _parse_page(data: object) -> int | None | Unset:

sheet_query_request = cls(
query=query,
namespace_name=namespace_name,
limit=limit,
page=page,
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cirro_api_client"
version = "1.7.1"
version = "1.7.2"
description = "A client library for accessing Cirro"
authors = ["Cirro <support@cirro.bio>"]
license = "MIT"
Expand Down
Loading