-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Description
Hey π
I was just trying to integrate this SDK into an existing code base and immediately dropped the idea.
Can you elaborate why (from what I've seen so far) every single field in the entity model of this SDK is Optional?
This is a nightmare to use in a typed code base. After I've started to integrate the SDK into an existing typed codebase, mypy goes completely rampage.
Very simple demo code:
from databricks.sdk import WorkspaceClient
client = WorkspaceClient()
response = client.experiments.get_run(run_id="<run-id>")
# okay
print(response)
# okay
print(response.run)
# but it could be None so this fails
# error: Item "Run" of "Run | None" has no attribute "lower" [union-attr]
print(response.run.lower())
# error: Item "None" of "Run | None" has no attribute "data" [union-attr]
print(response.run.data)
# error: Item "None" of "Run | None" has no attribute "data" [union-attr]
# error: Item "None" of "RunData | Any | None" has no attribute "tags" [union-attr]
print(response.run.data.tags)Using the dataclasses in it's current state is somewhat impossible unless I'm getting the usage of this SDK completely wrong.
stevie-, nickreynke and free-jore
Metadata
Metadata
Assignees
Labels
No labels