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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ with DataConnectClient.connect(
token="your-bearer-token",
) as client:

studies = client.studies(search_study_name="ACME", page=1, page_size=10)
study = studies[0]
studies = client.get_studies(search_study_name="ACME")
Comment thread
slingampalli-mdsol marked this conversation as resolved.
```
## Development

Expand Down
16 changes: 0 additions & 16 deletions dataconnect/_encoding.py

This file was deleted.

16 changes: 0 additions & 16 deletions dataconnect/auth.py

This file was deleted.

Empty file removed dataconnect/framework/__init__.py
Empty file.
99 changes: 0 additions & 99 deletions dataconnect/framework/pyarrow_transport.py

This file was deleted.

44 changes: 0 additions & 44 deletions dataconnect/framework/transport.py

This file was deleted.

2 changes: 1 addition & 1 deletion dataconnect/service/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_studies(self) -> list[Study]:

try:
return [resource_to_study(r) for r in resources]
except (KeyError, TypeError, ValueError) as ex:
except (IndexError, KeyError, TypeError, ValueError) as ex:
raise ValidationError(f"Unexpected studies response format: {ex}") from ex

def close(self) -> None:
Expand Down
4 changes: 4 additions & 0 deletions dataconnect/service/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
import json
from uuid import UUID

from dataconnect.exceptions import NotFoundError
from dataconnect.models import Study, StudyEnvironment
from dataconnect.transport.models import ResourceInfo


def resource_to_study(resource: ResourceInfo) -> Study:
"""Parse a transport-layer ``ResourceInfo`` into a ``Study`` domain object."""

if not resource or not resource.endpoints or not resource.endpoints[0].ticket:
raise NotFoundError("Invalid resource: missing endpoints or ticket")

data = json.loads(resource.endpoints[0].ticket.decode("utf-8"))

return Study(
Expand Down
4 changes: 3 additions & 1 deletion dataconnect/transport/arrow_flight/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def list_resources(self, request: ResourceQuery) -> list[ResourceInfo]:
flight_type = _ACTION_FLIGHT_TYPE.get(request.action)

if flight_type is None:
raise TransportConnectionError(f"Unknown action: {request.action!r}")
raise TransportStatusError(
f"Unknown action: {request.action!r}", status_code=3, grpc_status="INVALID_ARGUMENT"
)
Comment thread
slingampalli-mdsol marked this conversation as resolved.

body = json.loads(request.body) if request.body else {}
criteria = json.dumps({**body, "flight_type": flight_type}, separators=(",", ":")).encode("utf-8")
Expand Down
Loading