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.2.0"
".": "3.3.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 74
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-2501e64cd24ad589fc833556bbecd5f54321add8f57b18c6af3503a75be0101f.yml
configured_endpoints: 81
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/datamini%2Fasktable-f78191153cae54be3e273ca76fbb91453dec4696f00fc6d679ca2ffc3d533ede.yml
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# Changelog

## 3.3.0 (2024-11-24)

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

### Features

* **api:** api update ([#31](https://github.com/DataMini/asktable-python/issues/31)) ([268e767](https://github.com/DataMini/asktable-python/commit/268e7672c52e944ce5b86bfb463417ae469b8d03))
* **api:** api update ([#33](https://github.com/DataMini/asktable-python/issues/33)) ([5a4660f](https://github.com/DataMini/asktable-python/commit/5a4660f423deb1ec5edf2a30d44153e00e0771be))
* **api:** api update ([#34](https://github.com/DataMini/asktable-python/issues/34)) ([5db3b77](https://github.com/DataMini/asktable-python/commit/5db3b773117673385135f57c382531417ad72704))
* **api:** api update ([#35](https://github.com/DataMini/asktable-python/issues/35)) ([3d90aa2](https://github.com/DataMini/asktable-python/commit/3d90aa24c6b9312433627ded99833dae3fac32d7))
* **api:** api update ([#36](https://github.com/DataMini/asktable-python/issues/36)) ([9433649](https://github.com/DataMini/asktable-python/commit/943364966023a54ae6a022a8da5b818f0617e3ee))
* **api:** api update ([#39](https://github.com/DataMini/asktable-python/issues/39)) ([0e888dd](https://github.com/DataMini/asktable-python/commit/0e888dd2fcc907d7bb48d7a8cdcf0054063b2f28))
* **api:** api update ([#40](https://github.com/DataMini/asktable-python/issues/40)) ([7d4f6fb](https://github.com/DataMini/asktable-python/commit/7d4f6fbc4ffa228a0a3a9faa2cda71c73cb6aa67))
* **api:** api update ([#41](https://github.com/DataMini/asktable-python/issues/41)) ([95f8c27](https://github.com/DataMini/asktable-python/commit/95f8c270621f46c785261b7ef2356aa326b11905))
* **api:** api update ([#42](https://github.com/DataMini/asktable-python/issues/42)) ([1e6ad9f](https://github.com/DataMini/asktable-python/commit/1e6ad9fa9fee86eb869a88a6a7457b10a321b1dd))
* **api:** manual updates ([#43](https://github.com/DataMini/asktable-python/issues/43)) ([f58065b](https://github.com/DataMini/asktable-python/commit/f58065b10b0af77e5761d0e7bfc6120a5a33ab9b))
* **api:** manual updates ([#44](https://github.com/DataMini/asktable-python/issues/44)) ([8e6183c](https://github.com/DataMini/asktable-python/commit/8e6183c1d338f7a2fe0179f190503ee0fdc520d1))


### Chores

* rebuild project due to codegen change ([#37](https://github.com/DataMini/asktable-python/issues/37)) ([3da94d2](https://github.com/DataMini/asktable-python/commit/3da94d2c69fc812bec6b5ef0dc5f934ba58e706e))
* rebuild project due to codegen change ([#38](https://github.com/DataMini/asktable-python/issues/38)) ([34b494d](https://github.com/DataMini/asktable-python/commit/34b494d2398512da5a44cc6ae6e13a54d324247c))

## 3.2.0 (2024-11-12)

Full Changelog: [v3.1.0...v3.2.0](https://github.com/DataMini/asktable-python/compare/v3.1.0...v3.2.0)
Expand Down
75 changes: 71 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ from asktable import Asktable

client = Asktable()

datasource = client.datasources.list()
print(datasource.items)
datasource = client.datasources.create(
engine="mysql",
)
print(datasource.id)
```

While you can provide an `api_key` keyword argument,
Expand All @@ -49,8 +51,10 @@ client = AsyncAsktable()


async def main() -> None:
datasource = await client.datasources.list()
print(datasource.items)
datasource = await client.datasources.create(
engine="mysql",
)
print(datasource.id)


asyncio.run(main())
Expand All @@ -67,6 +71,69 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ

Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.

## Pagination

List methods in the Asktable API are paginated.

This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:

```python
from asktable import Asktable

client = Asktable()

all_datasources = []
# Automatically fetches more pages as needed.
for datasource in client.datasources.list():
# Do something with datasource here
all_datasources.append(datasource)
print(all_datasources)
```

Or, asynchronously:

```python
import asyncio
from asktable import AsyncAsktable

client = AsyncAsktable()


async def main() -> None:
all_datasources = []
# Iterate through items across all pages, issuing requests as needed.
async for datasource in client.datasources.list():
all_datasources.append(datasource)
print(all_datasources)


asyncio.run(main())
```

Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:

```python
first_page = await client.datasources.list()
if first_page.has_next_page():
print(f"will fetch next page using these details: {first_page.next_page_info()}")
next_page = await first_page.get_next_page()
print(f"number of items we just fetched: {len(next_page.items)}")

# Remove `await` for non-async usage.
```

Or just work directly with the returned data:

```python
first_page = await client.datasources.list()

print(f"page number: {first_page.page}") # => "page number: 1"
for datasource in first_page.items:
print(datasource.id)

# Remove `await` for non-async usage.
```

## Handling errors

When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `asktable.APIConnectionError` is raised.
Expand Down
Loading
Loading