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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.4.0"
".": "0.5.0"
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.5.0 (2024-01-04)

Full Changelog: [v0.4.0...v0.5.0](https://github.com/Dataherald/dataherald-python/compare/v0.4.0...v0.5.0)

### Features

* **api:** OpenAPI spec update ([#10](https://github.com/Dataherald/dataherald-python/issues/10)) ([179ba32](https://github.com/Dataherald/dataherald-python/commit/179ba3233c8b16d0747dc806c5b2c36a67f88119))

## 0.4.0 (2024-01-04)

Full Changelog: [v0.3.0...v0.4.0](https://github.com/Dataherald/dataherald-python/compare/v0.3.0...v0.4.0)
Expand Down
24 changes: 6 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ client = Dataherald(
environment="staging",
)

db_connection_response = client.database_connections.create(
db_connection_request_json="string",
)
db_connection_response = client.database_connections.create()
print(db_connection_response.id)
```

Expand All @@ -60,9 +58,7 @@ client = AsyncDataherald(


async def main() -> None:
db_connection_response = await client.database_connections.create(
db_connection_request_json="string",
)
db_connection_response = await client.database_connections.create()
print(db_connection_response.id)


Expand Down Expand Up @@ -96,9 +92,7 @@ from dataherald import Dataherald
client = Dataherald()

try:
client.database_connections.create(
db_connection_request_json="string",
)
client.database_connections.create()
except dataherald.APIConnectionError as e:
print("The server could not be reached")
print(e.__cause__) # an underlying Exception, likely raised within httpx.
Expand Down Expand Up @@ -141,9 +135,7 @@ client = Dataherald(
)

# Or, configure per-request:
client.with_options(max_retries=5).database_connections.create(
db_connection_request_json="string",
)
client.with_options(max_retries=5).database_connections.create()
```

### Timeouts
Expand All @@ -166,9 +158,7 @@ client = Dataherald(
)

# Override per-request:
client.with_options(timeout=5 * 1000).database_connections.create(
db_connection_request_json="string",
)
client.with_options(timeout=5 * 1000).database_connections.create()
```

On timeout, an `APITimeoutError` is thrown.
Expand Down Expand Up @@ -207,9 +197,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from dataherald import Dataherald

client = Dataherald()
response = client.database_connections.with_raw_response.create(
db_connection_request_json="string",
)
response = client.database_connections.with_raw_response.create()
print(response.headers.get('X-My-Header'))

database_connection = response.parse() # get the object that `database_connections.create()` would have returned
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "dataherald"
version = "0.4.0"
version = "0.5.0"
description = "The official Python library for the Dataherald API"
readme = "README.md"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/dataherald/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless.

__title__ = "dataherald"
__version__ = "0.4.0" # x-release-please-version
__version__ = "0.5.0" # x-release-please-version
157 changes: 82 additions & 75 deletions src/dataherald/resources/database_connections/database_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Mapping, cast
from typing import TYPE_CHECKING, Union

import httpx

Expand All @@ -19,9 +19,8 @@
Query,
Headers,
NotGiven,
FileTypes,
)
from ..._utils import extract_files, maybe_transform, deepcopy_minimal
from ..._utils import maybe_transform
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from ..._base_client import (
Expand All @@ -46,8 +45,13 @@ def __init__(self, client: Dataherald) -> None:
def create(
self,
*,
db_connection_request_json: str,
file: FileTypes | NotGiven = NOT_GIVEN,
alias: str | NotGiven = NOT_GIVEN,
connection_uri: str | NotGiven = NOT_GIVEN,
credential_file_content: Union[object, str] | NotGiven = NOT_GIVEN,
llm_api_key: str | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
ssh_settings: database_connection_create_params.SshSettings | NotGiven = NOT_GIVEN,
use_ssh: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -56,7 +60,7 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DBConnectionResponse:
"""
Api Add Db Connection
Add Db Connection

Args:
extra_headers: Send extra headers
Expand All @@ -67,23 +71,20 @@ def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
body = deepcopy_minimal(
{
"db_connection_request_json": db_connection_request_json,
"file": file,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
if files:
# It should be noted that the actual Content-Type header that will be
# sent to the server will contain a `boundary` parameter, e.g.
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}

return self._post(
"/api/database-connections",
body=maybe_transform(body, database_connection_create_params.DatabaseConnectionCreateParams),
files=files,
body=maybe_transform(
{
"alias": alias,
"connection_uri": connection_uri,
"credential_file_content": credential_file_content,
"llm_api_key": llm_api_key,
"metadata": metadata,
"ssh_settings": ssh_settings,
"use_ssh": use_ssh,
},
database_connection_create_params.DatabaseConnectionCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -125,8 +126,13 @@ def update(
self,
id: str,
*,
db_connection_request_json: str,
file: FileTypes | NotGiven = NOT_GIVEN,
alias: str | NotGiven = NOT_GIVEN,
connection_uri: str | NotGiven = NOT_GIVEN,
credential_file_content: Union[object, str] | NotGiven = NOT_GIVEN,
llm_api_key: str | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
ssh_settings: database_connection_update_params.SshSettings | NotGiven = NOT_GIVEN,
use_ssh: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -135,7 +141,7 @@ def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DBConnectionResponse:
"""
Api Update Db Connection
Update Db Connection

Args:
extra_headers: Send extra headers
Expand All @@ -146,23 +152,20 @@ def update(

timeout: Override the client-level default timeout for this request, in seconds
"""
body = deepcopy_minimal(
{
"db_connection_request_json": db_connection_request_json,
"file": file,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
if files:
# It should be noted that the actual Content-Type header that will be
# sent to the server will contain a `boundary` parameter, e.g.
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}

return self._put(
f"/api/database-connections/{id}",
body=maybe_transform(body, database_connection_update_params.DatabaseConnectionUpdateParams),
files=files,
body=maybe_transform(
{
"alias": alias,
"connection_uri": connection_uri,
"credential_file_content": credential_file_content,
"llm_api_key": llm_api_key,
"metadata": metadata,
"ssh_settings": ssh_settings,
"use_ssh": use_ssh,
},
database_connection_update_params.DatabaseConnectionUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -201,8 +204,13 @@ def __init__(self, client: AsyncDataherald) -> None:
async def create(
self,
*,
db_connection_request_json: str,
file: FileTypes | NotGiven = NOT_GIVEN,
alias: str | NotGiven = NOT_GIVEN,
connection_uri: str | NotGiven = NOT_GIVEN,
credential_file_content: Union[object, str] | NotGiven = NOT_GIVEN,
llm_api_key: str | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
ssh_settings: database_connection_create_params.SshSettings | NotGiven = NOT_GIVEN,
use_ssh: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -211,7 +219,7 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DBConnectionResponse:
"""
Api Add Db Connection
Add Db Connection

Args:
extra_headers: Send extra headers
Expand All @@ -222,23 +230,20 @@ async def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
body = deepcopy_minimal(
{
"db_connection_request_json": db_connection_request_json,
"file": file,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
if files:
# It should be noted that the actual Content-Type header that will be
# sent to the server will contain a `boundary` parameter, e.g.
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}

return await self._post(
"/api/database-connections",
body=maybe_transform(body, database_connection_create_params.DatabaseConnectionCreateParams),
files=files,
body=maybe_transform(
{
"alias": alias,
"connection_uri": connection_uri,
"credential_file_content": credential_file_content,
"llm_api_key": llm_api_key,
"metadata": metadata,
"ssh_settings": ssh_settings,
"use_ssh": use_ssh,
},
database_connection_create_params.DatabaseConnectionCreateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -280,8 +285,13 @@ async def update(
self,
id: str,
*,
db_connection_request_json: str,
file: FileTypes | NotGiven = NOT_GIVEN,
alias: str | NotGiven = NOT_GIVEN,
connection_uri: str | NotGiven = NOT_GIVEN,
credential_file_content: Union[object, str] | NotGiven = NOT_GIVEN,
llm_api_key: str | NotGiven = NOT_GIVEN,
metadata: object | NotGiven = NOT_GIVEN,
ssh_settings: database_connection_update_params.SshSettings | NotGiven = NOT_GIVEN,
use_ssh: bool | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -290,7 +300,7 @@ async def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DBConnectionResponse:
"""
Api Update Db Connection
Update Db Connection

Args:
extra_headers: Send extra headers
Expand All @@ -301,23 +311,20 @@ async def update(

timeout: Override the client-level default timeout for this request, in seconds
"""
body = deepcopy_minimal(
{
"db_connection_request_json": db_connection_request_json,
"file": file,
}
)
files = extract_files(cast(Mapping[str, object], body), paths=[["file"]])
if files:
# It should be noted that the actual Content-Type header that will be
# sent to the server will contain a `boundary` parameter, e.g.
# multipart/form-data; boundary=---abc--
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}

return await self._put(
f"/api/database-connections/{id}",
body=maybe_transform(body, database_connection_update_params.DatabaseConnectionUpdateParams),
files=files,
body=maybe_transform(
{
"alias": alias,
"connection_uri": connection_uri,
"credential_file_content": credential_file_content,
"llm_api_key": llm_api_key,
"metadata": metadata,
"ssh_settings": ssh_settings,
"use_ssh": use_ssh,
},
database_connection_update_params.DatabaseConnectionUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
Loading