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 @@
{
".": "3.5.0"
".": "3.6.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 82
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-4bee800ad604492e6ee5776c10e1668037755aeaae6ff6faa2d09a0c3763eeee.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-8e9dc6bfba12f2eba83e978265436d2d6daabb89b04188ee749a32b3e2a6f55d.yml
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# Changelog

## 3.6.0 (2024-12-10)

Full Changelog: [v3.5.0...v3.6.0](https://github.com/DataMini/asktable-python/compare/v3.5.0...v3.6.0)

### Features

* **api:** api update ([#56](https://github.com/DataMini/asktable-python/issues/56)) ([85f14bf](https://github.com/DataMini/asktable-python/commit/85f14bf4c1a6ab1847ea70a1f92ab9fc6b84792d))
* **api:** api update ([#58](https://github.com/DataMini/asktable-python/issues/58)) ([d8e87aa](https://github.com/DataMini/asktable-python/commit/d8e87aa6f7882c7c30c25876c9cd97b975108487))
* **api:** api update ([#60](https://github.com/DataMini/asktable-python/issues/60)) ([d2fde2c](https://github.com/DataMini/asktable-python/commit/d2fde2c2c9dce66f76a81110ece132d64d7e91df))
* **api:** api update ([#61](https://github.com/DataMini/asktable-python/issues/61)) ([b2a2931](https://github.com/DataMini/asktable-python/commit/b2a2931c8ff148f7c9289e5f3a26e212f0a00b6a))
* **api:** api update ([#62](https://github.com/DataMini/asktable-python/issues/62)) ([9a0ade8](https://github.com/DataMini/asktable-python/commit/9a0ade84afdd1533abe882ddff731b7e62dfe949))


### Bug Fixes

* **client:** compat with new httpx 0.28.0 release ([#55](https://github.com/DataMini/asktable-python/issues/55)) ([9b90d53](https://github.com/DataMini/asktable-python/commit/9b90d53934ef35395dd9760e0440cf97e6e0c148))


### Chores

* **internal:** bump pydantic dependency ([#63](https://github.com/DataMini/asktable-python/issues/63)) ([73e26c6](https://github.com/DataMini/asktable-python/commit/73e26c6a80a0a77afaa0a7592f255a2505ac2dcf))
* **internal:** bump pyright ([#57](https://github.com/DataMini/asktable-python/issues/57)) ([a4d4a4c](https://github.com/DataMini/asktable-python/commit/a4d4a4c6a4e9c0bc6f84eccd33ffba754f90a6e5))
* **internal:** codegen related update ([#52](https://github.com/DataMini/asktable-python/issues/52)) ([5ca5165](https://github.com/DataMini/asktable-python/commit/5ca5165218fbe650f9ce1d4dc27cbc2b258c5b62))
* **internal:** codegen related update ([#64](https://github.com/DataMini/asktable-python/issues/64)) ([aa903ed](https://github.com/DataMini/asktable-python/commit/aa903ede9be8e28ba1c2f05cda4455940627f630))
* **internal:** exclude mypy from running on tests ([#54](https://github.com/DataMini/asktable-python/issues/54)) ([3e6ef7b](https://github.com/DataMini/asktable-python/commit/3e6ef7bdd00bd2af75f762c5002d754b314fdf99))
* make the `Omit` type public ([#59](https://github.com/DataMini/asktable-python/issues/59)) ([ebaba2d](https://github.com/DataMini/asktable-python/commit/ebaba2d5e62fad4fa7091436b5713d1096620090))

## 3.5.0 (2024-11-25)

Full Changelog: [v3.4.0...v3.5.0](https://github.com/DataMini/asktable-python/compare/v3.4.0...v3.5.0)
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ Note that requests that time out are [retried twice by default](#retries).

We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.

You can enable logging by setting the environment variable `ASKTABLE_LOG` to `debug`.
You can enable logging by setting the environment variable `ASKTABLE_LOG` to `info`.

```shell
$ export ASKTABLE_LOG=debug
$ export ASKTABLE_LOG=info
```

Or to `debug` for more verbose logging.

### How to tell whether `None` means `null` or missing

In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:
Expand Down Expand Up @@ -331,18 +333,19 @@ can also get all the extra fields on the Pydantic model as a dict with

You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

- Support for proxies
- Custom transports
- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)
- Custom [transports](https://www.python-httpx.org/advanced/transports/)
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

```python
import httpx
from asktable import Asktable, DefaultHttpxClient

client = Asktable(
# Or use the `ASKTABLE_BASE_URL` env var
base_url="http://my.test.server.example.com:8083",
http_client=DefaultHttpxClient(
proxies="http://my.test.proxy.example.com",
proxy="http://my.test.proxy.example.com",
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
),
)
Expand Down
5 changes: 4 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ show_error_codes = True
# Exclude _files.py because mypy isn't smart enough to apply
# the correct type narrowing and as this is an internal module
# it's fine to just use Pyright.
exclude = ^(src/asktable/_files\.py|_dev/.*\.py)$
#
# We also exclude our `tests` as mypy doesn't always infer
# types correctly and Pyright will still catch any type errors.
exclude = ^(src/asktable/_files\.py|_dev/.*\.py|tests/.*)$

strict_equality = True
implicit_reexport = True
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "asktable"
version = "3.5.0"
version = "3.6.0"
description = "The official Python library for the asktable API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand All @@ -14,7 +14,6 @@ dependencies = [
"anyio>=3.5.0, <5",
"distro>=1.7.0, <2",
"sniffio",
"cached-property; python_version < '3.8'",
]
requires-python = ">= 3.8"
classifiers = [
Expand Down
7 changes: 4 additions & 3 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
pydantic==2.9.2
pydantic==2.10.3
# via asktable
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
pygments==2.18.0
# via rich
pyright==1.1.380
pyright==1.1.389
pytest==8.3.3
# via pytest-asyncio
pytest-asyncio==0.24.0
Expand Down Expand Up @@ -97,6 +97,7 @@ typing-extensions==4.12.2
# via mypy
# via pydantic
# via pydantic-core
# via pyright
virtualenv==20.24.5
# via nox
zipp==3.17.0
Expand Down
4 changes: 2 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ httpx==0.25.2
idna==3.4
# via anyio
# via httpx
pydantic==2.9.2
pydantic==2.10.3
# via asktable
pydantic-core==2.23.4
pydantic-core==2.27.1
# via pydantic
sniffio==1.3.0
# via anyio
Expand Down
3 changes: 2 additions & 1 deletion src/asktable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from . import types
from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
from ._client import (
Client,
Expand Down Expand Up @@ -46,6 +46,7 @@
"ProxiesTypes",
"NotGiven",
"NOT_GIVEN",
"Omit",
"AsktableError",
"APIError",
"APIStatusError",
Expand Down
12 changes: 8 additions & 4 deletions src/asktable/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ def __init__(
custom_query: Mapping[str, object] | None = None,
_strict_response_validation: bool,
) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
Expand All @@ -804,6 +805,7 @@ def __init__(
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand All @@ -813,6 +815,7 @@ def __init__(
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")

if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand Down Expand Up @@ -856,10 +859,9 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
)

def is_closed(self) -> bool:
Expand Down Expand Up @@ -1358,6 +1360,7 @@ def __init__(
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
Expand All @@ -1370,6 +1373,7 @@ def __init__(
limits = DEFAULT_CONNECTION_LIMITS

if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand All @@ -1379,6 +1383,7 @@ def __init__(
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")

if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
Expand Down Expand Up @@ -1422,10 +1427,9 @@ def __init__(
base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
)

def is_closed(self) -> bool:
Expand Down
8 changes: 3 additions & 5 deletions src/asktable/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def model_dump(
exclude=exclude,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
warnings=warnings,
# warnings are not supported in Pydantic v1
warnings=warnings if PYDANTIC_V2 else True,
)
return cast(
"dict[str, Any]",
Expand Down Expand Up @@ -213,9 +214,6 @@ def __set_name__(self, owner: type[Any], name: str) -> None: ...
# __set__ is not defined at runtime, but @cached_property is designed to be settable
def __set__(self, instance: object, value: _T) -> None: ...
else:
try:
from functools import cached_property as cached_property
except ImportError:
from cached_property import cached_property as cached_property
from functools import cached_property as cached_property

typed_cached_property = cached_property
6 changes: 2 additions & 4 deletions src/asktable/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,8 @@ def get(self, __key: str) -> str | None: ...
StrBytesIntFloat = Union[str, bytes, int, float]

# Note: copied from Pydantic
# https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49
IncEx: TypeAlias = Union[
Set[int], Set[str], Mapping[int, Union["IncEx", Literal[True]]], Mapping[str, Union["IncEx", Literal[True]]]
]
# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79
IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]]

PostParser = Callable[[Any], Any]

Expand Down
2 changes: 1 addition & 1 deletion src/asktable/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "asktable"
__version__ = "3.5.0" # x-release-please-version
__version__ = "3.6.0" # x-release-please-version
4 changes: 2 additions & 2 deletions src/asktable/resources/datasources/datasources.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def with_streaming_response(self) -> DatasourcesResourceWithStreamingResponse:
def create(
self,
*,
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"],
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"],
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -428,7 +428,7 @@ def with_streaming_response(self) -> AsyncDatasourcesResourceWithStreamingRespon
async def create(
self,
*,
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"],
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"],
async_process_meta: bool | NotGiven = NOT_GIVEN,
value_index: bool | NotGiven = NOT_GIVEN,
access_config: Optional[datasource_create_params.AccessConfig] | NotGiven = NOT_GIVEN,
Expand Down
20 changes: 10 additions & 10 deletions src/asktable/resources/securetunnels.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def with_streaming_response(self) -> SecuretunnelsResourceWithStreamingResponse:
def create(
self,
*,
name: Optional[str] | NotGiven = NOT_GIVEN,
name: str,
# 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 Down Expand Up @@ -124,8 +124,8 @@ def update(
self,
securetunnel_id: str,
*,
name: str,
client_info: Optional[object] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
unique_key: Optional[str] | 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.
Expand All @@ -138,10 +138,10 @@ def update(
更新某个 ATST

Args:
client_info: 客户端信息

name: SecureTunnel 名称,不超过 20 个字符

client_info: 客户端信息

unique_key: 唯一标识,用于更新客户端信息(容器 ID)

extra_headers: Send extra headers
Expand All @@ -158,8 +158,8 @@ def update(
f"/securetunnels/{securetunnel_id}",
body=maybe_transform(
{
"client_info": client_info,
"name": name,
"client_info": client_info,
"unique_key": unique_key,
},
securetunnel_update_params.SecuretunnelUpdateParams,
Expand Down Expand Up @@ -325,7 +325,7 @@ def with_streaming_response(self) -> AsyncSecuretunnelsResourceWithStreamingResp
async def create(
self,
*,
name: Optional[str] | NotGiven = NOT_GIVEN,
name: str,
# 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 Down Expand Up @@ -393,8 +393,8 @@ async def update(
self,
securetunnel_id: str,
*,
name: str,
client_info: Optional[object] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
unique_key: Optional[str] | 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.
Expand All @@ -407,10 +407,10 @@ async def update(
更新某个 ATST

Args:
client_info: 客户端信息

name: SecureTunnel 名称,不超过 20 个字符

client_info: 客户端信息

unique_key: 唯一标识,用于更新客户端信息(容器 ID)

extra_headers: Send extra headers
Expand All @@ -427,8 +427,8 @@ async def update(
f"/securetunnels/{securetunnel_id}",
body=await async_maybe_transform(
{
"client_info": client_info,
"name": name,
"client_info": client_info,
"unique_key": unique_key,
},
securetunnel_update_params.SecuretunnelUpdateParams,
Expand Down
5 changes: 4 additions & 1 deletion src/asktable/types/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class AccessConfig(BaseModel):
db: Optional[str] = None
"""数据库引擎可以管理多个数据库,此参数用于指定数据库名称"""

db_version: Optional[str] = None
"""数据库版本"""

host: Optional[str] = None
"""数据库地址"""

Expand Down Expand Up @@ -48,7 +51,7 @@ class Datasource(BaseModel):
created_at: datetime
"""创建时间"""

engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks"]
engine: Literal["mysql", "tidb", "postgresql", "oceanbase", "clickhouse", "csv", "excel", "starrocks", "hive"]
"""数据源引擎"""

meta_status: Literal["processing", "failed", "success", "unprocessed"]
Expand Down
Loading
Loading