Skip to content

Commit faa56c4

Browse files
committed
Update documents
1 parent a103e58 commit faa56c4

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

README.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,46 @@ which would produce:
255255
1575454204, "a", "0001", ["a", "b", "c"]
256256
1575454204, "b", "0002", ["d", "e", "f"]
257257
258+
Type Hints
259+
----------
260+
261+
td-client-python includes comprehensive type hints (PEP 484) for improved development experience with static type checkers like mypy and pyright. Type hints are available for all public APIs.
262+
263+
**Features:**
264+
265+
266+
* Fully typed public API with precise type annotations
267+
* ``py.typed`` marker file for PEP 561 compliance
268+
* Type aliases in ``tdclient.types`` for common patterns
269+
* Support for type checking with mypy, pyright, and other tools
270+
271+
**Example with type checking:**
272+
273+
.. code-block:: python
274+
275+
import tdclient
276+
277+
# Type checkers will understand the types
278+
with tdclient.Client(apikey="your_api_key") as client:
279+
# client is inferred as tdclient.Client
280+
job = client.query("sample_db", "SELECT COUNT(1) FROM table", type="presto")
281+
# job is inferred as tdclient.models.Job
282+
job.wait()
283+
for row in job.result():
284+
# row is inferred as dict[str, Any]
285+
print(row)
286+
287+
**Using type aliases:**
288+
289+
.. code-block:: python
290+
291+
from tdclient.types import QueryEngineType, Priority
292+
293+
def run_query(engine: QueryEngineType, priority: Priority) -> None:
294+
with tdclient.Client() as client:
295+
job = client.query("mydb", "SELECT 1", type=engine, priority=priority)
296+
job.wait()
297+
258298
Development
259299
-----------
260300

docs/api/client.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@ tdclient.client
1111
:members:
1212
:undoc-members:
1313
:show-inheritance:
14-
15-

docs/file_import_parameters.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ contains ``"not-an-int"``, the resulting ``ValueError`` will not be caught.
7474
To summarise, the default for reading CSV files is:
7575

7676
``dialect=csv.excel, encoding="utf-8", columns=None, dtypes=None, converters=None``
77-
77+
7878
TSV data
7979
--------
8080

0 commit comments

Comments
 (0)