Skip to content

Commit cc65044

Browse files
authored
[synapse-artifacts] release for Octorber (Azure#32646)
* re-generated new SDK code * Add a input file * fix ci Build Analyze failure * fix version error * regenerate new code since api updated * Remove Credential Operation * remove unused credential py file * Delete sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/aio/operations/_credentials_operations.py * Delete sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/aio/operations/_credential_operations.py
1 parent f8ab7b0 commit cc65044

File tree

60 files changed

+1867
-2643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1867
-2643
lines changed

sdk/synapse/azure-synapse-artifacts/CHANGELOG.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Release History
22

3-
## 0.17.1 (Unreleased)
4-
5-
### Features Added
6-
7-
### Breaking Changes
3+
## 0.18.0 (2023-10-30)
84

95
### Bugs Fixed
106

7+
- Fix runNotebook sessionId from int to string #25210
8+
- Fix placeholder links causing 404s #26143
9+
1110
### Other Changes
1211

12+
- Sync expression Support From DataFactory To Synapse #25054
13+
1314
## 0.17.0 (2023-07-28)
1415

1516
### Features Added
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/_artifacts_client.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import Any, TYPE_CHECKING
1111

1212
from azure.core import PipelineClient
13+
from azure.core.pipeline import policies
1314
from azure.core.rest import HttpRequest, HttpResponse
1415

1516
from . import models as _models
@@ -104,7 +105,7 @@ class ArtifactsClient: # pylint: disable=client-accepts-api-version-keyword,too
104105
:param credential: Credential needed for the client to connect to Azure. Required.
105106
:type credential: ~azure.core.credentials.TokenCredential
106107
:param endpoint: The workspace development endpoint, for example
107-
https://myworkspace.dev.azuresynapse.net. Required.
108+
``https://myworkspace.dev.azuresynapse.net``. Required.
108109
:type endpoint: str
109110
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
110111
Retry-After header is present.
@@ -113,7 +114,24 @@ class ArtifactsClient: # pylint: disable=client-accepts-api-version-keyword,too
113114
def __init__(self, credential: "TokenCredential", endpoint: str, **kwargs: Any) -> None:
114115
_endpoint = "{endpoint}"
115116
self._config = ArtifactsClientConfiguration(credential=credential, endpoint=endpoint, **kwargs)
116-
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
117+
_policies = kwargs.pop("policies", None)
118+
if _policies is None:
119+
_policies = [
120+
policies.RequestIdPolicy(**kwargs),
121+
self._config.headers_policy,
122+
self._config.user_agent_policy,
123+
self._config.proxy_policy,
124+
policies.ContentDecodePolicy(**kwargs),
125+
self._config.redirect_policy,
126+
self._config.retry_policy,
127+
self._config.authentication_policy,
128+
self._config.custom_hook_policy,
129+
self._config.logging_policy,
130+
policies.DistributedTracingPolicy(**kwargs),
131+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
132+
self._config.http_logging_policy,
133+
]
134+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
117135

118136
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
119137
self._serialize = Serializer(client_models)
@@ -180,7 +198,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
180198
}
181199

182200
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
183-
return self._client.send_request(request_copy, **kwargs)
201+
return self._client.send_request(request_copy, **kwargs) # type: ignore
184202

185203
def close(self) -> None:
186204
self._client.close()

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/_configuration.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312

1413
from ._version import VERSION
@@ -18,7 +17,7 @@
1817
from azure.core.credentials import TokenCredential
1918

2019

21-
class ArtifactsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class ArtifactsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2221
"""Configuration for ArtifactsClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
@@ -27,12 +26,11 @@ class ArtifactsClientConfiguration(Configuration): # pylint: disable=too-many-i
2726
:param credential: Credential needed for the client to connect to Azure. Required.
2827
:type credential: ~azure.core.credentials.TokenCredential
2928
:param endpoint: The workspace development endpoint, for example
30-
https://myworkspace.dev.azuresynapse.net. Required.
29+
``https://myworkspace.dev.azuresynapse.net``. Required.
3130
:type endpoint: str
3231
"""
3332

3433
def __init__(self, credential: "TokenCredential", endpoint: str, **kwargs: Any) -> None:
35-
super(ArtifactsClientConfiguration, self).__init__(**kwargs)
3634
if credential is None:
3735
raise ValueError("Parameter 'credential' must not be None.")
3836
if endpoint is None:
@@ -42,6 +40,7 @@ def __init__(self, credential: "TokenCredential", endpoint: str, **kwargs: Any)
4240
self.endpoint = endpoint
4341
self.credential_scopes = kwargs.pop("credential_scopes", ["https://dev.azuresynapse.net/.default"])
4442
kwargs.setdefault("sdk_moniker", "synapse-artifacts/{}".format(VERSION))
43+
self.polling_interval = kwargs.get("polling_interval", 30)
4544
self._configure(**kwargs)
4645

4746
def _configure(self, **kwargs: Any) -> None:

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/_serialization.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class Model(object):
295295
_validation: Dict[str, Dict[str, Any]] = {}
296296

297297
def __init__(self, **kwargs: Any) -> None:
298-
self.additional_properties: Dict[str, Any] = {}
298+
self.additional_properties: Optional[Dict[str, Any]] = {}
299299
for k in kwargs:
300300
if k not in self._attribute_map:
301301
_LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__)
@@ -351,7 +351,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON:
351351
:rtype: dict
352352
"""
353353
serializer = Serializer(self._infer_class_models())
354-
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs)
354+
return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore
355355

356356
def as_dict(
357357
self,
@@ -390,7 +390,7 @@ def my_key_transformer(key, attr_desc, value):
390390
:rtype: dict
391391
"""
392392
serializer = Serializer(self._infer_class_models())
393-
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs)
393+
return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore
394394

395395
@classmethod
396396
def _infer_class_models(cls):
@@ -415,7 +415,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N
415415
:raises: DeserializationError if something went wrong
416416
"""
417417
deserializer = Deserializer(cls._infer_class_models())
418-
return deserializer(cls.__name__, data, content_type=content_type)
418+
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
419419

420420
@classmethod
421421
def from_dict(
@@ -445,7 +445,7 @@ def from_dict(
445445
if key_extractors is None
446446
else key_extractors
447447
)
448-
return deserializer(cls.__name__, data, content_type=content_type)
448+
return deserializer(cls.__name__, data, content_type=content_type) # type: ignore
449449

450450
@classmethod
451451
def _flatten_subtype(cls, key, objects):
@@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
662662
_serialized.update(_new_attr) # type: ignore
663663
_new_attr = _new_attr[k] # type: ignore
664664
_serialized = _serialized[k]
665-
except ValueError:
666-
continue
665+
except ValueError as err:
666+
if isinstance(err, SerializationError):
667+
raise
667668

668669
except (AttributeError, KeyError, TypeError) as err:
669670
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
@@ -729,6 +730,8 @@ def url(self, name, data, data_type, **kwargs):
729730

730731
if kwargs.get("skip_quote") is True:
731732
output = str(output)
733+
# https://github.com/Azure/autorest.python/issues/2063
734+
output = output.replace("{", quote("{")).replace("}", quote("}"))
732735
else:
733736
output = quote(str(output), safe="")
734737
except SerializationError:
@@ -741,6 +744,8 @@ def query(self, name, data, data_type, **kwargs):
741744
742745
:param data: The data to be serialized.
743746
:param str data_type: The type to be serialized from.
747+
:keyword bool skip_quote: Whether to skip quote the serialized result.
748+
Defaults to False.
744749
:rtype: str
745750
:raises: TypeError if serialization fails.
746751
:raises: ValueError if data is None
@@ -749,10 +754,8 @@ def query(self, name, data, data_type, **kwargs):
749754
# Treat the list aside, since we don't want to encode the div separator
750755
if data_type.startswith("["):
751756
internal_data_type = data_type[1:-1]
752-
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
753-
if not kwargs.get("skip_quote", False):
754-
data = [quote(str(d), safe="") for d in data]
755-
return str(self.serialize_iter(data, internal_data_type, **kwargs))
757+
do_quote = not kwargs.get("skip_quote", False)
758+
return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)
756759

757760
# Not a list, regular serialization
758761
output = self.serialize_data(data, data_type, **kwargs)
@@ -891,6 +894,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
891894
not be None or empty.
892895
:param str div: If set, this str will be used to combine the elements
893896
in the iterable into a combined string. Default is 'None'.
897+
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
898+
Defaults to False.
894899
:rtype: list, str
895900
"""
896901
if isinstance(data, str):
@@ -903,9 +908,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
903908
for d in data:
904909
try:
905910
serialized.append(self.serialize_data(d, iter_type, **kwargs))
906-
except ValueError:
911+
except ValueError as err:
912+
if isinstance(err, SerializationError):
913+
raise
907914
serialized.append(None)
908915

916+
if kwargs.get("do_quote", False):
917+
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]
918+
909919
if div:
910920
serialized = ["" if s is None else str(s) for s in serialized]
911921
serialized = div.join(serialized)
@@ -950,7 +960,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
950960
for key, value in attr.items():
951961
try:
952962
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
953-
except ValueError:
963+
except ValueError as err:
964+
if isinstance(err, SerializationError):
965+
raise
954966
serialized[self.serialize_unicode(key)] = None
955967

956968
if "xml" in serialization_ctxt:
@@ -1900,7 +1912,7 @@ def deserialize_date(attr):
19001912
if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore
19011913
raise DeserializationError("Date must have only digits and -. Received: %s" % attr)
19021914
# This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception.
1903-
return isodate.parse_date(attr, defaultmonth=None, defaultday=None)
1915+
return isodate.parse_date(attr, defaultmonth=0, defaultday=0)
19041916

19051917
@staticmethod
19061918
def deserialize_time(attr):

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/_vendor.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
66
# --------------------------------------------------------------------------
77

8-
from typing import List, cast
9-
108
from azure.core.pipeline.transport import HttpRequest
119

1210

@@ -16,15 +14,3 @@ def _convert_request(request, files=None):
1614
if files:
1715
request.set_formdata_body(files)
1816
return request
19-
20-
21-
def _format_url_section(template, **kwargs):
22-
components = template.split("/")
23-
while components:
24-
try:
25-
return template.format(**kwargs)
26-
except KeyError as key:
27-
# Need the cast, as for some reasons "split" is typed as list[str | Any]
28-
formatted_components = cast(List[str], template.split("/"))
29-
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
30-
template = "/".join(components)

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "0.17.1"
9+
VERSION = "0.18.0"

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/aio/_artifacts_client.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import Any, Awaitable, TYPE_CHECKING
1111

1212
from azure.core import AsyncPipelineClient
13+
from azure.core.pipeline import policies
1314
from azure.core.rest import AsyncHttpResponse, HttpRequest
1415

1516
from .. import models as _models
@@ -107,7 +108,7 @@ class ArtifactsClient: # pylint: disable=client-accepts-api-version-keyword,too
107108
:param credential: Credential needed for the client to connect to Azure. Required.
108109
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
109110
:param endpoint: The workspace development endpoint, for example
110-
https://myworkspace.dev.azuresynapse.net. Required.
111+
``https://myworkspace.dev.azuresynapse.net``. Required.
111112
:type endpoint: str
112113
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
113114
Retry-After header is present.
@@ -116,7 +117,24 @@ class ArtifactsClient: # pylint: disable=client-accepts-api-version-keyword,too
116117
def __init__(self, credential: "AsyncTokenCredential", endpoint: str, **kwargs: Any) -> None:
117118
_endpoint = "{endpoint}"
118119
self._config = ArtifactsClientConfiguration(credential=credential, endpoint=endpoint, **kwargs)
119-
self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs)
120+
_policies = kwargs.pop("policies", None)
121+
if _policies is None:
122+
_policies = [
123+
policies.RequestIdPolicy(**kwargs),
124+
self._config.headers_policy,
125+
self._config.user_agent_policy,
126+
self._config.proxy_policy,
127+
policies.ContentDecodePolicy(**kwargs),
128+
self._config.redirect_policy,
129+
self._config.retry_policy,
130+
self._config.authentication_policy,
131+
self._config.custom_hook_policy,
132+
self._config.logging_policy,
133+
policies.DistributedTracingPolicy(**kwargs),
134+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
135+
self._config.http_logging_policy,
136+
]
137+
self._client: AsyncPipelineClient = AsyncPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
120138

121139
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
122140
self._serialize = Serializer(client_models)
@@ -183,7 +201,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH
183201
}
184202

185203
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
186-
return self._client.send_request(request_copy, **kwargs)
204+
return self._client.send_request(request_copy, **kwargs) # type: ignore
187205

188206
async def close(self) -> None:
189207
await self._client.close()

sdk/synapse/azure-synapse-artifacts/azure/synapse/artifacts/aio/_configuration.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312

1413
from .._version import VERSION
@@ -18,7 +17,7 @@
1817
from azure.core.credentials_async import AsyncTokenCredential
1918

2019

21-
class ArtifactsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class ArtifactsClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2221
"""Configuration for ArtifactsClient.
2322
2423
Note that all parameters used to create this instance are saved as instance
@@ -27,12 +26,11 @@ class ArtifactsClientConfiguration(Configuration): # pylint: disable=too-many-i
2726
:param credential: Credential needed for the client to connect to Azure. Required.
2827
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
2928
:param endpoint: The workspace development endpoint, for example
30-
https://myworkspace.dev.azuresynapse.net. Required.
29+
``https://myworkspace.dev.azuresynapse.net``. Required.
3130
:type endpoint: str
3231
"""
3332

3433
def __init__(self, credential: "AsyncTokenCredential", endpoint: str, **kwargs: Any) -> None:
35-
super(ArtifactsClientConfiguration, self).__init__(**kwargs)
3634
if credential is None:
3735
raise ValueError("Parameter 'credential' must not be None.")
3836
if endpoint is None:
@@ -42,6 +40,7 @@ def __init__(self, credential: "AsyncTokenCredential", endpoint: str, **kwargs:
4240
self.endpoint = endpoint
4341
self.credential_scopes = kwargs.pop("credential_scopes", ["https://dev.azuresynapse.net/.default"])
4442
kwargs.setdefault("sdk_moniker", "synapse-artifacts/{}".format(VERSION))
43+
self.polling_interval = kwargs.get("polling_interval", 30)
4544
self._configure(**kwargs)
4645

4746
def _configure(self, **kwargs: Any) -> None:

0 commit comments

Comments
 (0)