Skip to content

Commit

Permalink
[Storage]Address comments for STG78 GA (#20491)
Browse files Browse the repository at this point in the history
* [Storage]Address comments for STG78 GA

* [Storage]Address comments for STG78 GA
  • Loading branch information
xiafu-msft authored Sep 1, 2021
1 parent 1099723 commit ae49de0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,9 @@ def _quick_query_options(self, query_expression,
# type: (str, **Any) -> Dict[str, Any]
delimiter = '\n'
input_format = kwargs.pop('blob_format', None)
if input_format == QuickQueryDialect.DelimitedJsonDialect:
if input_format == QuickQueryDialect.DelimitedJson:
input_format = DelimitedJsonDialect()
if input_format == QuickQueryDialect.DelimitedTextDialect:
if input_format == QuickQueryDialect.DelimitedText:
input_format = DelimitedTextDialect()
input_parquet_format = input_format == "ParquetDialect"
if input_format and not input_parquet_format:
Expand All @@ -868,9 +868,9 @@ def _quick_query_options(self, query_expression,
raise ValueError("The Type of blob_format can only be DelimitedTextDialect or "
"DelimitedJsonDialect or ParquetDialect")
output_format = kwargs.pop('output_format', None)
if output_format == QuickQueryDialect.DelimitedJsonDialect:
if output_format == QuickQueryDialect.DelimitedJson:
output_format = DelimitedJsonDialect()
if output_format == QuickQueryDialect.DelimitedTextDialect:
if output_format == QuickQueryDialect.DelimitedText:
output_format = DelimitedTextDialect()
if output_format:
if output_format == "ParquetDialect":
Expand Down
12 changes: 6 additions & 6 deletions sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class PremiumPageBlobTier(str, Enum):
class QuickQueryDialect(str, Enum):
"""Specifies the quick query input/output dialect."""

DelimitedTextDialect = 'DelimitedTextDialect'
DelimitedJsonDialect = 'DelimitedJsonDialect'
ParquetDialect = 'ParquetDialect'
DelimitedText = 'DelimitedTextDialect'
DelimitedJson = 'DelimitedJsonDialect'
Parquet = 'ParquetDialect'


class SequenceNumberAction(str, Enum):
Expand Down Expand Up @@ -321,7 +321,7 @@ class ContainerProperties(DictMixin):
Represents whether the container has an immutability policy.
:ivar bool has_legal_hold:
Represents whether the container has a legal hold.
:ivar bool is_immutable_storage_with_versioning_enabled:
:ivar bool immutable_storage_with_versioning_enabled:
Represents whether immutable storage with versioning enabled on the container.
.. versionadded:: 12.10.0
Expand Down Expand Up @@ -349,7 +349,7 @@ def __init__(self, **kwargs):
self.has_legal_hold = kwargs.get('x-ms-has-legal-hold')
self.metadata = kwargs.get('metadata')
self.encryption_scope = None
self.is_immutable_storage_with_versioning_enabled = kwargs.get('x-ms-immutable-storage-with-versioning-enabled')
self.immutable_storage_with_versioning_enabled = kwargs.get('x-ms-immutable-storage-with-versioning-enabled')
default_encryption_scope = kwargs.get('x-ms-default-encryption-scope')
if default_encryption_scope:
self.encryption_scope = ContainerEncryptionScope(
Expand All @@ -366,7 +366,7 @@ def _from_generated(cls, generated):
props.lease = LeaseProperties._from_generated(generated) # pylint: disable=protected-access
props.public_access = generated.properties.public_access
props.has_immutability_policy = generated.properties.has_immutability_policy
props.is_immutable_storage_with_versioning_enabled = \
props.immutable_storage_with_versioning_enabled = \
generated.properties.is_immutable_storage_with_versioning_enabled
props.deleted = generated.deleted
props.version = generated.version
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-blob/tests/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def test_list_containers(self, resource_group, location, storage_account, storag
self.assertNamedItemInContainer(containers, container.container_name)
self.assertIsNotNone(containers[0].has_immutability_policy)
self.assertIsNotNone(containers[0].has_legal_hold)
self.assertIsNotNone(containers[0].is_immutable_storage_with_versioning_enabled)
self.assertIsNotNone(containers[0].immutable_storage_with_versioning_enabled)

@GlobalStorageAccountPreparer()
def test_list_containers_with_prefix(self, resource_group, location, storage_account, storage_account_key):
Expand Down Expand Up @@ -401,7 +401,7 @@ def test_get_container_properties(self, resource_group, location, storage_accoun
# Assert
self.assertIsNotNone(props)
self.assertDictEqual(props.metadata, metadata)
self.assertIsNotNone(props.is_immutable_storage_with_versioning_enabled)
self.assertIsNotNone(props.immutable_storage_with_versioning_enabled)
# self.assertEqual(props.lease.duration, 'infinite')
# self.assertEqual(props.lease.state, 'leased')
# self.assertEqual(props.lease.status, 'locked')
Expand Down
4 changes: 2 additions & 2 deletions sdk/storage/azure-storage-blob/tests/test_container_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ async def test_list_containers(self, resource_group, location, storage_account,
self.assertNamedItemInContainer(containers, container.container_name)
self.assertIsNotNone(containers[0].has_immutability_policy)
self.assertIsNotNone(containers[0].has_legal_hold)
self.assertIsNotNone(containers[0].is_immutable_storage_with_versioning_enabled)
self.assertIsNotNone(containers[0].immutable_storage_with_versioning_enabled)

@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
Expand Down Expand Up @@ -500,7 +500,7 @@ async def test_get_container_properties(self, resource_group, location, storage_
# Assert
self.assertIsNotNone(props)
self.assertDictEqual(props.metadata, metadata)
self.assertIsNotNone(props.is_immutable_storage_with_versioning_enabled)
self.assertIsNotNone(props.immutable_storage_with_versioning_enabled)
# self.assertEqual(props.lease.duration, 'infinite')
# self.assertEqual(props.lease.state, 'leased')
# self.assertEqual(props.lease.status, 'locked')
Expand Down
2 changes: 1 addition & 1 deletion sdk/storage/azure-storage-blob/tests/test_quick_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ def test_quick_query_input_in_parquet_format(self, resource_group, location, sto
with open(parquet_path, "rb") as parquet_data:
blob_client.upload_blob(parquet_data, overwrite=True)

reader = blob_client.query_blob(expression, blob_format=QuickQueryDialect.ParquetDialect)
reader = blob_client.query_blob(expression, blob_format=QuickQueryDialect.Parquet)
real_data = reader.readall()

self.assertEqual(real_data, expected_data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,9 @@ class ArrowDialect(BlobArrowDialect):
class QuickQueryDialect(str, Enum):
"""Specifies the quick query input/output dialect."""

DelimitedTextDialect = 'DelimitedTextDialect'
DelimitedJsonDialect = 'DelimitedJsonDialect'
ParquetDialect = 'ParquetDialect'
DelimitedText = 'DelimitedTextDialect'
DelimitedJson = 'DelimitedJsonDialect'
Parquet = 'ParquetDialect'


class ArrowType(str, Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def test_quick_query_input_in_parquet_format(self, datalake_storage_account_name
with open(parquet_path, "rb") as parquet_data:
file_client.upload_data(parquet_data, overwrite=True)

reader = file_client.query_file(expression, file_format=QuickQueryDialect.ParquetDialect)
reader = file_client.query_file(expression, file_format=QuickQueryDialect.Parquet)
real_data = reader.readall()

self.assertEqual(real_data, expected_data)
Expand All @@ -924,7 +924,7 @@ def test_quick_query_output_in_parquet_format(self, datalake_storage_account_nam

with self.assertRaises(ValueError):
file_client.query_file(
expression, file_format=QuickQueryDialect.ParquetDialect,
output_format=QuickQueryDialect.ParquetDialect)
expression, file_format=QuickQueryDialect.Parquet,
output_format=QuickQueryDialect.Parquet)

# ------------------------------------------------------------------------------

0 comments on commit ae49de0

Please sign in to comment.