Skip to content

Commit

Permalink
Only use from_dict when using headers
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcast-db committed Feb 16, 2024
1 parent 30f21a2 commit dd6bd52
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .codegen/service.py.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,13 @@ class {{.Name}}API:{{if .Description}}
{{- end}}

{{define "deserialize-stream" -}}
deserialized = {{.Response.PascalName}}.from_dict(res)
{{if or .Response.HasJsonField .Response.HasHeaderField -}}
deserialized = {{.Response.PascalName}}.from_dict(res)
{{.Response.PascalName}}.{{.ResponseBodyField.CamelName}}=content
return deserialized
{{- else -}}
return {{.Response.PascalName}}({{.ResponseBodyField.CamelName}}=res)
{{end}}
{{- end}}

{{define "method-do" -}}
Expand Down
4 changes: 1 addition & 3 deletions databricks/sdk/service/billing.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions databricks/sdk/service/files.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion databricks/sdk/service/sql.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/integration/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def test_files_api_upload_download(ucws, random):
target_file = f'/Volumes/main/{schema}/{volume}/filesit-{random()}.txt'
w.files.upload(target_file, f)
m = w.files.get_metadata(target_file)
assert m.content_type == 'text/plain'
assert m.content_type == 'application/octet-stream'
with w.files.download(target_file).contents as f:
assert f.read() == b"some text data"

Expand Down

0 comments on commit dd6bd52

Please sign in to comment.