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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"cached-property; python_version < '3.8'",

]
requires-python = ">= 3.7"
Expand Down
10 changes: 10 additions & 0 deletions src/dataherald/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,13 @@ class GenericModel(pydantic.BaseModel):

class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel):
...


# cached properties
if TYPE_CHECKING:
cached_property = property
else:
try:
from functools import cached_property as cached_property
except ImportError:
from cached_property import cached_property as cached_property
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, Union
from typing import Union

import httpx

Expand All @@ -21,26 +21,24 @@
NotGiven,
)
from ..._utils import maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from ..._base_client import (
make_request_options,
)

if TYPE_CHECKING:
from ..._client import Dataherald, AsyncDataherald

__all__ = ["DatabaseConnections", "AsyncDatabaseConnections"]


class DatabaseConnections(SyncAPIResource):
drivers: Drivers
with_raw_response: DatabaseConnectionsWithRawResponse
@cached_property
def drivers(self) -> Drivers:
return Drivers(self._client)

def __init__(self, client: Dataherald) -> None:
super().__init__(client)
self.drivers = Drivers(client)
self.with_raw_response = DatabaseConnectionsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> DatabaseConnectionsWithRawResponse:
return DatabaseConnectionsWithRawResponse(self)

def create(
self,
Expand Down Expand Up @@ -193,13 +191,13 @@ def list(


class AsyncDatabaseConnections(AsyncAPIResource):
drivers: AsyncDrivers
with_raw_response: AsyncDatabaseConnectionsWithRawResponse
@cached_property
def drivers(self) -> AsyncDrivers:
return AsyncDrivers(self._client)

def __init__(self, client: AsyncDataherald) -> None:
super().__init__(client)
self.drivers = AsyncDrivers(client)
self.with_raw_response = AsyncDatabaseConnectionsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> AsyncDatabaseConnectionsWithRawResponse:
return AsyncDatabaseConnectionsWithRawResponse(self)

async def create(
self,
Expand Down
22 changes: 7 additions & 15 deletions src/dataherald/resources/database_connections/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

from typing import TYPE_CHECKING

import httpx

from ..._types import (
Expand All @@ -13,25 +11,21 @@
Headers,
NotGiven,
)
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from ..._base_client import (
make_request_options,
)
from ...types.database_connections import DriverListResponse

if TYPE_CHECKING:
from ..._client import Dataherald, AsyncDataherald

__all__ = ["Drivers", "AsyncDrivers"]


class Drivers(SyncAPIResource):
with_raw_response: DriversWithRawResponse

def __init__(self, client: Dataherald) -> None:
super().__init__(client)
self.with_raw_response = DriversWithRawResponse(self)
@cached_property
def with_raw_response(self) -> DriversWithRawResponse:
return DriversWithRawResponse(self)

def list(
self,
Expand All @@ -54,11 +48,9 @@ def list(


class AsyncDrivers(AsyncAPIResource):
with_raw_response: AsyncDriversWithRawResponse

def __init__(self, client: AsyncDataherald) -> None:
super().__init__(client)
self.with_raw_response = AsyncDriversWithRawResponse(self)
@cached_property
def with_raw_response(self) -> AsyncDriversWithRawResponse:
return AsyncDriversWithRawResponse(self)

async def list(
self,
Expand Down
22 changes: 7 additions & 15 deletions src/dataherald/resources/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

from typing import TYPE_CHECKING

import httpx

from .._types import (
Expand All @@ -14,24 +12,20 @@
NotGiven,
UnknownResponse,
)
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from .._base_client import (
make_request_options,
)

if TYPE_CHECKING:
from .._client import Dataherald, AsyncDataherald

__all__ = ["Engine", "AsyncEngine"]


class Engine(SyncAPIResource):
with_raw_response: EngineWithRawResponse

def __init__(self, client: Dataherald) -> None:
super().__init__(client)
self.with_raw_response = EngineWithRawResponse(self)
@cached_property
def with_raw_response(self) -> EngineWithRawResponse:
return EngineWithRawResponse(self)

def heartbeat(
self,
Expand All @@ -54,11 +48,9 @@ def heartbeat(


class AsyncEngine(AsyncAPIResource):
with_raw_response: AsyncEngineWithRawResponse

def __init__(self, client: AsyncDataherald) -> None:
super().__init__(client)
self.with_raw_response = AsyncEngineWithRawResponse(self)
@cached_property
def with_raw_response(self) -> AsyncEngineWithRawResponse:
return AsyncEngineWithRawResponse(self)

async def heartbeat(
self,
Expand Down
22 changes: 8 additions & 14 deletions src/dataherald/resources/finetunings.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, List
from typing import List

import httpx

Expand All @@ -20,24 +20,20 @@
NotGiven,
)
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from .._base_client import (
make_request_options,
)

if TYPE_CHECKING:
from .._client import Dataherald, AsyncDataherald

__all__ = ["Finetunings", "AsyncFinetunings"]


class Finetunings(SyncAPIResource):
with_raw_response: FinetuningsWithRawResponse

def __init__(self, client: Dataherald) -> None:
super().__init__(client)
self.with_raw_response = FinetuningsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> FinetuningsWithRawResponse:
return FinetuningsWithRawResponse(self)

def create(
self,
Expand Down Expand Up @@ -152,11 +148,9 @@ def list(


class AsyncFinetunings(AsyncAPIResource):
with_raw_response: AsyncFinetuningsWithRawResponse

def __init__(self, client: AsyncDataherald) -> None:
super().__init__(client)
self.with_raw_response = AsyncFinetuningsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> AsyncFinetuningsWithRawResponse:
return AsyncFinetuningsWithRawResponse(self)

async def create(
self,
Expand Down
21 changes: 7 additions & 14 deletions src/dataherald/resources/generations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

from typing import TYPE_CHECKING
from typing_extensions import Literal

import httpx
Expand All @@ -22,25 +21,21 @@
NotGiven,
)
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from .._base_client import (
make_request_options,
)
from ..types.shared import NlGenerationResponse

if TYPE_CHECKING:
from .._client import Dataherald, AsyncDataherald

__all__ = ["Generations", "AsyncGenerations"]


class Generations(SyncAPIResource):
with_raw_response: GenerationsWithRawResponse

def __init__(self, client: Dataherald) -> None:
super().__init__(client)
self.with_raw_response = GenerationsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> GenerationsWithRawResponse:
return GenerationsWithRawResponse(self)

def create(
self,
Expand Down Expand Up @@ -259,11 +254,9 @@ def sql_generation(


class AsyncGenerations(AsyncAPIResource):
with_raw_response: AsyncGenerationsWithRawResponse

def __init__(self, client: AsyncDataherald) -> None:
super().__init__(client)
self.with_raw_response = AsyncGenerationsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> AsyncGenerationsWithRawResponse:
return AsyncGenerationsWithRawResponse(self)

async def create(
self,
Expand Down
22 changes: 8 additions & 14 deletions src/dataherald/resources/golden_sqls.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, List
from typing import List

import httpx

Expand All @@ -21,25 +21,21 @@
UnknownResponse,
)
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import to_raw_response_wrapper, async_to_raw_response_wrapper
from .._base_client import (
make_request_options,
)
from ..types.shared import GoldenSqlResponse

if TYPE_CHECKING:
from .._client import Dataherald, AsyncDataherald

__all__ = ["GoldenSqls", "AsyncGoldenSqls"]


class GoldenSqls(SyncAPIResource):
with_raw_response: GoldenSqlsWithRawResponse

def __init__(self, client: Dataherald) -> None:
super().__init__(client)
self.with_raw_response = GoldenSqlsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> GoldenSqlsWithRawResponse:
return GoldenSqlsWithRawResponse(self)

def retrieve(
self,
Expand Down Expand Up @@ -183,11 +179,9 @@ def upload(


class AsyncGoldenSqls(AsyncAPIResource):
with_raw_response: AsyncGoldenSqlsWithRawResponse

def __init__(self, client: AsyncDataherald) -> None:
super().__init__(client)
self.with_raw_response = AsyncGoldenSqlsWithRawResponse(self)
@cached_property
def with_raw_response(self) -> AsyncGoldenSqlsWithRawResponse:
return AsyncGoldenSqlsWithRawResponse(self)

async def retrieve(
self,
Expand Down
Loading