Skip to content

Commit bbe81c1

Browse files
authored
Update OpenAPI spec to 2 Oct 2023 (#373)
## Changes This PR updates the OpenAPI spec for Databricks SDK for Python. The main noteworthy changes are: 1. Changing the deserialization pathway for paginated, non-multi-request APIs (i.e., APIs that return an object containing an array of all listed values). Now, we will use the `from_dict` method for the Response class and return the named result field. "Multi-request" APIs are not changed (they still use a generator and fetch new pages incrementally on demand), and list APIs that return an array directly are not handled by the `method-call-paginated` template. ## Tests Reran all integration tests. Manually ran some code exercising the updated pathways, such as: ``` a.metastore_assignments.list(y.metastore_assignment.metastore_id) ```
1 parent 6254119 commit bbe81c1

25 files changed

+576
-176
lines changed

.codegen/_openapi_sha

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b52a3b410976501f08f76ca0b355fb2dca876953
1+
bcbf6e851e3d82fd910940910dd31c10c059746c

.codegen/service.py.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ class {{.Name}}API:{{if .Description}}
275275
{{- end}}
276276
{{else -}}
277277
json = {{template "method-do" .}}
278-
return [{{.Pagination.Entity.PascalName}}.from_dict(v) for v in json{{if .Pagination.Results}}.get('{{.Pagination.Results.Name}}', []){{end}}]
278+
parsed = {{.Response.PascalName}}.from_dict(json).{{.Pagination.Results.SnakeName}}
279+
return parsed if parsed is not None else []
279280
{{end}}
280281
{{- end}}
281282

@@ -312,7 +313,7 @@ self._api.do('{{.Verb}}',
312313
{{- else if .Response}} -> {{if .Response.ArrayValue -}}
313314
Iterator[{{template "type" .Response.ArrayValue}}]
314315
{{- else if .Pagination -}}
315-
Iterator[{{.Pagination.Entity.PascalName}}]
316+
Iterator[{{template "type" .Pagination.Entity}}]
316317
{{- else -}}
317318
{{- if .Response.IsExternal -}}
318319
{{.Response.Package.Name}}.{{.Response.PascalName}}
@@ -321,4 +322,3 @@ self._api.do('{{.Verb}}',
321322
{{- end -}}
322323
{{- end}}{{end}}
323324
{{- end}}
324-

databricks/sdk/__init__.py

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks/sdk/service/billing.py

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)