Skip to content

Cannot deserialize datetime object., error when running sample #22100

@MalfuncEddie

Description

@MalfuncEddie
  • Package Name:
    msrest
  • Package Version:
    0.6.21
  • Operating System:
    ubuntu 20.04
  • Python Version:
    Python 3.8.10
    azure-monitor-query==1.0.1
    azure-identity
    azure-mgmt-advisor==9.0.0b1
    azure-mgmt-resource==15.0.0
    black==21.12b0
    azure-core==1.20.1
    msrest==0.6.21

Describe the bug
A clear and concise description of what the bug is.
Running the following example gives me an Cannot deserialize datetime object., error

https://github.com/Azure/azure-sdk-for-python/blob/1508fb9b2d417e8dae41c8a4fb1ef26a32498af0/sdk/monitor/azure-monitor-query/samples/sample_logs_single_query.py

To Reproduce
Steps to reproduce the behavior:
1.
Run https://github.com/Azure/azure-sdk-for-python/blob/1508fb9b2d417e8dae41c8a4fb1ef26a32498af0/sdk/monitor/azure-monitor-query/samples/sample_logs_single_query.py

`
File "/azure_venv/lib/python3.8/site-packages/msrest/serialization.py", line 1943, in deserialize_iso
attr = attr.upper()
AttributeError: 'NoneType' object has no attribute 'upper'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "test.py", line 33, in
response = client.query_workspace(
File "/azure_venv/lib/python3.8/site-packages/azure/core/tracing/decorator.py", line 83, in wrapper_use_tracer
return func(*args, **kwargs)
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_logs_query_client.py", line 135, in query_workspace
response = LogsQueryResult._from_generated( # pylint: disable=protected-access
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_models.py", line 264, in _from_generated
tables = [
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_models.py", line 265, in
LogsTable._from_generated(table) # pylint: disable=protected-access
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_models.py", line 52, in _from_generated
return cls(
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_models.py", line 40, in init
self.rows = [
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_models.py", line 41, in
LogsTableRow(
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_models.py", line 71, in init
self._row = process_row(_col_types, row)
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_helpers.py", line 126, in process_row
return [native_col_type(col_types[ind], val) for ind, val in enumerate(row)]
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_helpers.py", line 126, in
return [native_col_type(col_types[ind], val) for ind, val in enumerate(row)]
File "/azure_venv/lib/python3.8/site-packages/azure/monitor/query/_helpers.py", line 119, in native_col_type
value = Deserializer.deserialize_iso(value)
File "/azure_venv/lib/python3.8/site-packages/msrest/serialization.py", line 1965, in deserialize_iso
raise_with_traceback(DeserializationError, msg, err)
File "/azure_venv/lib/python3.8/site-packages/msrest/exceptions.py", line 51, in raise_with_traceback
raise error.with_traceback(exc_traceback)
File "/azure_venv/lib/python3.8/site-packages/msrest/serialization.py", line 1943, in deserialize_iso
attr = attr.upper()
msrest.exceptions.DeserializationError: Cannot deserialize datetime object., AttributeError: 'NoneType' object has no attribute 'upper'

`

Expected behavior
Get a result from the query

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.MonitorMonitor, Monitor Ingestion, Monitor QuerybugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK team

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions