Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use autodoc typehints #2940

Merged
merged 24 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
48b8b08
docs: Add sphinx-autodoc-typehints
LeonLuttenberger Aug 22, 2024
7dc1372
s3: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
d81998d
catalog: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
2cb3919
athena: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
176432a
redshift: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
1447d37
add sphinx-autodoc-typehints to docs/environment.yml
LeonLuttenberger Aug 22, 2024
6e84904
remove more type hints from function docstrings
LeonLuttenberger Aug 22, 2024
dcce4e0
fix type hints for sqlserver module
LeonLuttenberger Aug 22, 2024
a7168f2
dataapi: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
c5767a1
data_quality: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
dd6152a
opensearch: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
dd2d3ad
neptune: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
b234cf9
dynamodb: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
0941083
timestream: remove type hints from function docstrings
LeonLuttenberger Aug 22, 2024
5a0bda9
emr: remove type hints from function docstrings
LeonLuttenberger Aug 23, 2024
5b442fe
cloudwatch: remove type hints from function docstrings
LeonLuttenberger Aug 23, 2024
c362d69
quicksight: remove type hints from function docstrings
LeonLuttenberger Aug 23, 2024
81965c1
fix remaining type hints
LeonLuttenberger Aug 23, 2024
7d7a658
fix autodoc type hints for mysql
LeonLuttenberger Aug 23, 2024
ce231d8
fix formatting
LeonLuttenberger Aug 23, 2024
5438d7b
fix type hints for optional dependencies
LeonLuttenberger Aug 23, 2024
c8be62d
set always_use_bars_union
LeonLuttenberger Aug 23, 2024
c49d13e
add missing typed dicts
LeonLuttenberger Aug 23, 2024
67f0cd1
Merge branch 'main' into docs/use-autodoc-typehints
LeonLuttenberger Aug 26, 2024
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
8 changes: 1 addition & 7 deletions awswrangler/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,9 @@ def reset(self, item: str | None = None) -> None:

Parameters
----------
item : str, optional
item
Configuration item name.

Returns
-------
None
None.

Examples
--------
>>> import awswrangler as wr
Expand All @@ -122,7 +117,6 @@ def to_pandas(self) -> pd.DataFrame:

Returns
-------
pd.DataFrame
Configuration DataFrame.

Examples
Expand Down
5 changes: 0 additions & 5 deletions awswrangler/athena/_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ def update_cache(self, items: list[dict[str, Any]]) -> None:
----------
items : List[Dict[str, Any]]
List of query execution metadata which is returned by boto3 `batch_get_query_execution()`.

Returns
-------
None
None.
"""
with self._lock:
if self._pqueue:
Expand Down
58 changes: 25 additions & 33 deletions awswrangler/athena/_executions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ def start_query_execution(

Parameters
----------
sql : str
sql
SQL query.
database : str, optional
database
AWS Glue/Athena database name.
s3_output : str, optional
s3_output
AWS S3 path.
workgroup : str
workgroup
Athena workgroup. Primary by default.
encryption : str, optional
encryption
None, 'SSE_S3', 'SSE_KMS', 'CSE_KMS'.
kms_key : str, optional
kms_key
For SSE-KMS and CSE-KMS , this is the KMS key ARN or ID.
params: Dict[str, any] | List[str], optional
params
Parameters that will be used for constructing the SQL query.
Only named or question mark parameters are supported.
The parameter style needs to be specified in the ``paramstyle`` parameter.
Expand All @@ -81,39 +81,38 @@ def start_query_execution(
For ``paramstyle="qmark"``, this value needs to be a list of strings.
The formatter will be applied server-side.
The values are applied sequentially to the parameters in the query in the order in which the parameters occur.
paramstyle: str, optional
paramstyle
Determines the style of ``params``.
Possible values are:

- ``named``
- ``qmark``
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
client_request_token : str, optional
boto3_session
The default boto3 session will be used if **boto3_session** receive ``None``.
client_request_token
A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once).
If another StartQueryExecution request is received, the same response is returned and another query is not created.
If a parameter has changed, for example, the QueryString , an error is returned.
If you pass the same client_request_token value with different parameters the query fails with error
message "Idempotent parameters do not match". Use this only with ctas_approach=False and unload_approach=False
and disabled cache.
athena_cache_settings: typing.AthenaCacheSettings, optional
athena_cache_settings
Parameters of the Athena cache settings such as max_cache_seconds, max_cache_query_inspections,
max_remote_cache_entries, and max_local_cache_entries.
AthenaCacheSettings is a `TypedDict`, meaning the passed parameter can be instantiated either as an
instance of AthenaCacheSettings or as a regular Python dict.
If cached results are valid, awswrangler ignores the `ctas_approach`, `s3_output`, `encryption`, `kms_key`,
`keep_files` and `ctas_temp_table_name` params.
If reading cached data fails for any reason, execution falls back to the usual query run path.
athena_query_wait_polling_delay: float, default: 1.0 seconds
athena_query_wait_polling_delay
Interval in seconds for how often the function will check if the Athena query has completed.
data_source : str, optional
data_source
Data Source / Catalog name. If None, 'AwsDataCatalog' will be used by default.
wait : bool, default False
wait
Indicates whether to wait for the query to finish and return a dictionary with the query execution response.

Returns
-------
Union[str, Dict[str, Any]]
Query execution ID if `wait` is set to `False`, dictionary with the get_query_execution response otherwise.

Examples
Expand Down Expand Up @@ -177,15 +176,10 @@ def stop_query_execution(query_execution_id: str, boto3_session: boto3.Session |

Parameters
----------
query_execution_id : str
query_execution_id
Athena query execution ID.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

Returns
-------
None
None.
boto3_session
The default boto3 session will be used if **boto3_session** receive ``None``.

Examples
--------
Expand All @@ -207,16 +201,15 @@ def wait_query(

Parameters
----------
query_execution_id : str
query_execution_id
Athena query execution ID.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
athena_query_wait_polling_delay: float, default: 1.0 seconds
boto3_session
The default boto3 session will be used if **boto3_session** receive ``None``.
athena_query_wait_polling_delay
Interval in seconds for how often the function will check if the Athena query has completed.

Returns
-------
Dict[str, Any]
Dictionary with the get_query_execution response.

Examples
Expand Down Expand Up @@ -247,14 +240,13 @@ def get_query_execution(query_execution_id: str, boto3_session: boto3.Session |

Parameters
----------
query_execution_id : str
query_execution_id
Athena query execution ID.
boto3_session : boto3.Session(), optional
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
boto3_session
The default boto3 session will be used if **boto3_session** receive ``None``.

Returns
-------
Dict[str, Any]
Dictionary with the get_query_execution response.

Examples
Expand Down
Loading
Loading