This is an automated email from the ASF dual-hosted git repository.
jedcunningham pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 5e567c2396 Cleanup Dataset API variable name and typing (#25073)
5e567c2396 is described below
commit 5e567c239625d2e436648796f8f1484ccbd3ed57
Author: Jed Cunningham <[email protected]>
AuthorDate: Thu Jul 14 22:04:44 2022 -0600
Cleanup Dataset API variable name and typing (#25073)
---
airflow/api_connexion/endpoints/dataset_endpoint.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/airflow/api_connexion/endpoints/dataset_endpoint.py
b/airflow/api_connexion/endpoints/dataset_endpoint.py
index a3c691b923..cfdc04f615 100644
--- a/airflow/api_connexion/endpoints/dataset_endpoint.py
+++ b/airflow/api_connexion/endpoints/dataset_endpoint.py
@@ -34,7 +34,7 @@ from airflow.utils.session import NEW_SESSION, provide_session
@security.requires_access([(permissions.ACTION_CAN_READ,
permissions.RESOURCE_DATASET)])
@provide_session
-def get_dataset(id, session):
+def get_dataset(id: int, session: Session = NEW_SESSION) -> APIResponse:
"""Get a Dataset"""
dataset = session.query(Dataset).get(id)
if not dataset:
@@ -52,10 +52,10 @@ def get_datasets(
*, limit: int, offset: int = 0, order_by: str = "id", session: Session =
NEW_SESSION
) -> APIResponse:
"""Get datasets"""
- allowed_filter_attrs = ['id', 'uri', 'created_at', 'updated_at']
+ allowed_attrs = ['id', 'uri', 'created_at', 'updated_at']
total_entries = session.query(func.count(Dataset.id)).scalar()
query = session.query(Dataset)
- query = apply_sorting(query, order_by, {}, allowed_filter_attrs)
+ query = apply_sorting(query, order_by, {}, allowed_attrs)
datasets = query.offset(offset).limit(limit).all()
return dataset_collection_schema.dump(DatasetCollection(datasets=datasets,
total_entries=total_entries))