Skip to content

Commit e45e50c

Browse files
committed
Update Python Client to 3.2.1rc1
1 parent 610b40a commit e45e50c

13 files changed

Lines changed: 302 additions & 8 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
under the License.
1818
-->
1919

20+
21+
# v3.2.1
22+
23+
## Bug Fixes:
24+
25+
- Fix: use Dag form when materializing asset ([#64211](https://github.com/apache/airflow/pull/64211))
26+
2027
# v3.2.0
2128

2229
## New Features:

airflow_client/client/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
""" # noqa: E501
1515

1616

17-
__version__ = "3.2.0"
17+
__version__ = "3.2.1"
1818

1919
# Define package exports
2020
__all__ = [
@@ -157,6 +157,7 @@
157157
"JobResponse",
158158
"LastAssetEventResponse",
159159
"LocationInner",
160+
"MaterializeAssetBody",
160161
"PatchTaskInstanceBody",
161162
"PluginCollectionResponse",
162163
"PluginImportErrorCollectionResponse",
@@ -352,6 +353,7 @@
352353
from airflow_client.client.models.job_response import JobResponse as JobResponse
353354
from airflow_client.client.models.last_asset_event_response import LastAssetEventResponse as LastAssetEventResponse
354355
from airflow_client.client.models.location_inner import LocationInner as LocationInner
356+
from airflow_client.client.models.materialize_asset_body import MaterializeAssetBody as MaterializeAssetBody
355357
from airflow_client.client.models.patch_task_instance_body import PatchTaskInstanceBody as PatchTaskInstanceBody
356358
from airflow_client.client.models.plugin_collection_response import PluginCollectionResponse as PluginCollectionResponse
357359
from airflow_client.client.models.plugin_import_error_collection_response import PluginImportErrorCollectionResponse as PluginImportErrorCollectionResponse

airflow_client/client/api/asset_api.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from airflow_client.client.models.asset_response import AssetResponse
2727
from airflow_client.client.models.create_asset_events_body import CreateAssetEventsBody
2828
from airflow_client.client.models.dag_run_response import DAGRunResponse
29+
from airflow_client.client.models.materialize_asset_body import MaterializeAssetBody
2930
from airflow_client.client.models.queued_event_collection_response import QueuedEventCollectionResponse
3031
from airflow_client.client.models.queued_event_response import QueuedEventResponse
3132

@@ -3884,6 +3885,7 @@ def _get_dag_asset_queued_events_serialize(
38843885
def materialize_asset(
38853886
self,
38863887
asset_id: StrictInt,
3888+
materialize_asset_body: Optional[MaterializeAssetBody] = None,
38873889
_request_timeout: Union[
38883890
None,
38893891
Annotated[StrictFloat, Field(gt=0)],
@@ -3903,6 +3905,8 @@ def materialize_asset(
39033905
39043906
:param asset_id: (required)
39053907
:type asset_id: int
3908+
:param materialize_asset_body:
3909+
:type materialize_asset_body: MaterializeAssetBody
39063910
:param _request_timeout: timeout setting for this request. If one
39073911
number provided, it will be total request
39083912
timeout. It can also be a pair (tuple) of
@@ -3927,6 +3931,7 @@ def materialize_asset(
39273931

39283932
_param = self._materialize_asset_serialize(
39293933
asset_id=asset_id,
3934+
materialize_asset_body=materialize_asset_body,
39303935
_request_auth=_request_auth,
39313936
_content_type=_content_type,
39323937
_headers=_headers,
@@ -3957,6 +3962,7 @@ def materialize_asset(
39573962
def materialize_asset_with_http_info(
39583963
self,
39593964
asset_id: StrictInt,
3965+
materialize_asset_body: Optional[MaterializeAssetBody] = None,
39603966
_request_timeout: Union[
39613967
None,
39623968
Annotated[StrictFloat, Field(gt=0)],
@@ -3976,6 +3982,8 @@ def materialize_asset_with_http_info(
39763982
39773983
:param asset_id: (required)
39783984
:type asset_id: int
3985+
:param materialize_asset_body:
3986+
:type materialize_asset_body: MaterializeAssetBody
39793987
:param _request_timeout: timeout setting for this request. If one
39803988
number provided, it will be total request
39813989
timeout. It can also be a pair (tuple) of
@@ -4000,6 +4008,7 @@ def materialize_asset_with_http_info(
40004008

40014009
_param = self._materialize_asset_serialize(
40024010
asset_id=asset_id,
4011+
materialize_asset_body=materialize_asset_body,
40034012
_request_auth=_request_auth,
40044013
_content_type=_content_type,
40054014
_headers=_headers,
@@ -4030,6 +4039,7 @@ def materialize_asset_with_http_info(
40304039
def materialize_asset_without_preload_content(
40314040
self,
40324041
asset_id: StrictInt,
4042+
materialize_asset_body: Optional[MaterializeAssetBody] = None,
40334043
_request_timeout: Union[
40344044
None,
40354045
Annotated[StrictFloat, Field(gt=0)],
@@ -4049,6 +4059,8 @@ def materialize_asset_without_preload_content(
40494059
40504060
:param asset_id: (required)
40514061
:type asset_id: int
4062+
:param materialize_asset_body:
4063+
:type materialize_asset_body: MaterializeAssetBody
40524064
:param _request_timeout: timeout setting for this request. If one
40534065
number provided, it will be total request
40544066
timeout. It can also be a pair (tuple) of
@@ -4073,6 +4085,7 @@ def materialize_asset_without_preload_content(
40734085

40744086
_param = self._materialize_asset_serialize(
40754087
asset_id=asset_id,
4088+
materialize_asset_body=materialize_asset_body,
40764089
_request_auth=_request_auth,
40774090
_content_type=_content_type,
40784091
_headers=_headers,
@@ -4098,6 +4111,7 @@ def materialize_asset_without_preload_content(
40984111
def _materialize_asset_serialize(
40994112
self,
41004113
asset_id,
4114+
materialize_asset_body,
41014115
_request_auth,
41024116
_content_type,
41034117
_headers,
@@ -4125,6 +4139,8 @@ def _materialize_asset_serialize(
41254139
# process the header parameters
41264140
# process the form parameters
41274141
# process the body parameter
4142+
if materialize_asset_body is not None:
4143+
_body_params = materialize_asset_body
41284144

41294145

41304146
# set the HTTP header `Accept`
@@ -4135,6 +4151,19 @@ def _materialize_asset_serialize(
41354151
]
41364152
)
41374153

4154+
# set the HTTP header `Content-Type`
4155+
if _content_type:
4156+
_header_params['Content-Type'] = _content_type
4157+
else:
4158+
_default_content_type = (
4159+
self.api_client.select_header_content_type(
4160+
[
4161+
'application/json'
4162+
]
4163+
)
4164+
)
4165+
if _default_content_type is not None:
4166+
_header_params['Content-Type'] = _default_content_type
41384167

41394168
# authentication setting
41404169
_auth_settings: List[str] = [

airflow_client/client/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(
9191
self.default_headers[header_name] = header_value
9292
self.cookie = cookie
9393
# Set default User-Agent.
94-
self.user_agent = 'OpenAPI-Generator/3.2.0/python'
94+
self.user_agent = 'OpenAPI-Generator/3.2.1/python'
9595
self.client_side_validation = configuration.client_side_validation
9696

9797
def __enter__(self):

airflow_client/client/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def to_debug_report(self) -> str:
541541
"OS: {env}\n"\
542542
"Python Version: {pyversion}\n"\
543543
"Version of the API: 2\n"\
544-
"SDK Package Version: 3.2.0".\
544+
"SDK Package Version: 3.2.1".\
545545
format(env=sys.platform, pyversion=sys.version)
546546

547547
def get_host_settings(self) -> List[HostSetting]:

airflow_client/client/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
from airflow_client.client.models.job_response import JobResponse
118118
from airflow_client.client.models.last_asset_event_response import LastAssetEventResponse
119119
from airflow_client.client.models.location_inner import LocationInner
120+
from airflow_client.client.models.materialize_asset_body import MaterializeAssetBody
120121
from airflow_client.client.models.patch_task_instance_body import PatchTaskInstanceBody
121122
from airflow_client.client.models.plugin_collection_response import PluginCollectionResponse
122123
from airflow_client.client.models.plugin_import_error_collection_response import PluginImportErrorCollectionResponse
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# coding: utf-8
2+
3+
"""
4+
Airflow API
5+
6+
Airflow API. All endpoints located under ``/api/v2`` can be used safely, are stable and backward compatible. Endpoints located under ``/ui`` are dedicated to the UI and are subject to breaking change depending on the need of the frontend. Users should not rely on those but use the public ones instead.
7+
8+
The version of the OpenAPI document: 2
9+
Generated by OpenAPI Generator (https://openapi-generator.tech)
10+
11+
Do not edit the class manually.
12+
""" # noqa: E501
13+
14+
15+
from __future__ import annotations
16+
import pprint
17+
import re # noqa: F401
18+
import json
19+
20+
from datetime import datetime
21+
from pydantic import BaseModel, ConfigDict, StrictStr
22+
from typing import Any, ClassVar, Dict, List, Optional
23+
from typing import Optional, Set
24+
from typing_extensions import Self
25+
from pydantic_core import to_jsonable_python
26+
27+
class MaterializeAssetBody(BaseModel):
28+
"""
29+
Materialize asset request.
30+
""" # noqa: E501
31+
conf: Optional[Dict[str, Any]] = None
32+
dag_run_id: Optional[StrictStr] = None
33+
data_interval_end: Optional[datetime] = None
34+
data_interval_start: Optional[datetime] = None
35+
logical_date: Optional[datetime] = None
36+
note: Optional[StrictStr] = None
37+
partition_key: Optional[StrictStr] = None
38+
run_after: Optional[datetime] = None
39+
additional_properties: Dict[str, Any] = {}
40+
__properties: ClassVar[List[str]] = ["conf", "dag_run_id", "data_interval_end", "data_interval_start", "logical_date", "note", "partition_key", "run_after"]
41+
42+
model_config = ConfigDict(
43+
validate_by_name=True,
44+
validate_by_alias=True,
45+
validate_assignment=True,
46+
protected_namespaces=(),
47+
)
48+
49+
50+
def to_str(self) -> str:
51+
"""Returns the string representation of the model using alias"""
52+
return pprint.pformat(self.model_dump(by_alias=True))
53+
54+
def to_json(self) -> str:
55+
"""Returns the JSON representation of the model using alias"""
56+
return json.dumps(to_jsonable_python(self.to_dict()))
57+
58+
@classmethod
59+
def from_json(cls, json_str: str) -> Optional[Self]:
60+
"""Create an instance of MaterializeAssetBody from a JSON string"""
61+
return cls.from_dict(json.loads(json_str))
62+
63+
def to_dict(self) -> Dict[str, Any]:
64+
"""Return the dictionary representation of the model using alias.
65+
66+
This has the following differences from calling pydantic's
67+
`self.model_dump(by_alias=True)`:
68+
69+
* `None` is only added to the output dict for nullable fields that
70+
were set at model initialization. Other fields with value `None`
71+
are ignored.
72+
* Fields in `self.additional_properties` are added to the output dict.
73+
"""
74+
excluded_fields: Set[str] = set([
75+
"additional_properties",
76+
])
77+
78+
_dict = self.model_dump(
79+
by_alias=True,
80+
exclude=excluded_fields,
81+
exclude_none=True,
82+
)
83+
# puts key-value pairs in additional_properties in the top level
84+
if self.additional_properties is not None:
85+
for _key, _value in self.additional_properties.items():
86+
_dict[_key] = _value
87+
88+
return _dict
89+
90+
@classmethod
91+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92+
"""Create an instance of MaterializeAssetBody from a dict"""
93+
if obj is None:
94+
return None
95+
96+
if not isinstance(obj, dict):
97+
return cls.model_validate(obj)
98+
99+
_obj = cls.model_validate({
100+
"conf": obj.get("conf"),
101+
"dag_run_id": obj.get("dag_run_id"),
102+
"data_interval_end": obj.get("data_interval_end"),
103+
"data_interval_start": obj.get("data_interval_start"),
104+
"logical_date": obj.get("logical_date"),
105+
"note": obj.get("note"),
106+
"partition_key": obj.get("partition_key"),
107+
"run_after": obj.get("run_after")
108+
})
109+
# store additional fields in additional_properties
110+
for _key in obj.keys():
111+
if _key not in cls.__properties:
112+
_obj.additional_properties[_key] = obj.get(_key)
113+
114+
return _obj
115+
116+

docs/AssetApi.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ Name | Type | Description | Notes
10871087
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
10881088

10891089
# **materialize_asset**
1090-
> DAGRunResponse materialize_asset(asset_id)
1090+
> DAGRunResponse materialize_asset(asset_id, materialize_asset_body=materialize_asset_body)
10911091
10921092
Materialize Asset
10931093

@@ -1101,6 +1101,7 @@ Materialize an asset by triggering a DAG run that produces it.
11011101
```python
11021102
import airflow_client.client
11031103
from airflow_client.client.models.dag_run_response import DAGRunResponse
1104+
from airflow_client.client.models.materialize_asset_body import MaterializeAssetBody
11041105
from airflow_client.client.rest import ApiException
11051106
from pprint import pprint
11061107

@@ -1127,10 +1128,11 @@ with airflow_client.client.ApiClient(configuration) as api_client:
11271128
# Create an instance of the API class
11281129
api_instance = airflow_client.client.AssetApi(api_client)
11291130
asset_id = 56 # int |
1131+
materialize_asset_body = airflow_client.client.MaterializeAssetBody() # MaterializeAssetBody | (optional)
11301132

11311133
try:
11321134
# Materialize Asset
1133-
api_response = api_instance.materialize_asset(asset_id)
1135+
api_response = api_instance.materialize_asset(asset_id, materialize_asset_body=materialize_asset_body)
11341136
print("The response of AssetApi->materialize_asset:\n")
11351137
pprint(api_response)
11361138
except Exception as e:
@@ -1145,6 +1147,7 @@ with airflow_client.client.ApiClient(configuration) as api_client:
11451147
Name | Type | Description | Notes
11461148
------------- | ------------- | ------------- | -------------
11471149
**asset_id** | **int**| |
1150+
**materialize_asset_body** | [**MaterializeAssetBody**](MaterializeAssetBody.md)| | [optional]
11481151

11491152
### Return type
11501153

@@ -1156,7 +1159,7 @@ Name | Type | Description | Notes
11561159

11571160
### HTTP request headers
11581161

1159-
- **Content-Type**: Not defined
1162+
- **Content-Type**: application/json
11601163
- **Accept**: application/json
11611164

11621165
### HTTP response details

docs/MaterializeAssetBody.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# MaterializeAssetBody
2+
3+
Materialize asset request.
4+
5+
## Properties
6+
7+
Name | Type | Description | Notes
8+
------------ | ------------- | ------------- | -------------
9+
**conf** | **Dict[str, object]** | | [optional]
10+
**dag_run_id** | **str** | | [optional]
11+
**data_interval_end** | **datetime** | | [optional]
12+
**data_interval_start** | **datetime** | | [optional]
13+
**logical_date** | **datetime** | | [optional]
14+
**note** | **str** | | [optional]
15+
**partition_key** | **str** | | [optional]
16+
**run_after** | **datetime** | | [optional]
17+
18+
## Example
19+
20+
```python
21+
from airflow_client.client.models.materialize_asset_body import MaterializeAssetBody
22+
23+
# TODO update the JSON string below
24+
json = "{}"
25+
# create an instance of MaterializeAssetBody from a JSON string
26+
materialize_asset_body_instance = MaterializeAssetBody.from_json(json)
27+
# print the JSON string representation of the object
28+
print(MaterializeAssetBody.to_json())
29+
30+
# convert the object into a dict
31+
materialize_asset_body_dict = materialize_asset_body_instance.to_dict()
32+
# create an instance of MaterializeAssetBody from a dict
33+
materialize_asset_body_from_dict = MaterializeAssetBody.from_dict(materialize_asset_body_dict)
34+
```
35+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
36+
37+

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
[build-system]
1919
requires = [
2020
"hatchling==1.29.0",
21-
"packaging==26.0",
21+
"packaging==26.1",
2222
"pathspec==1.0.4",
2323
"pluggy==1.6.0",
2424
"tomli==2.4.1; python_version < '3.11'",

0 commit comments

Comments
 (0)