locked
datetime format in python RRS feed

  • Question

  • I need to store a valid DateTime in an Azure table -- and ironically have trouble ensuring that it's the proper edm.DateTime format.

    I'm following the python test in the test_tableservice.py

    https://github.com/WindowsAzure/azure-sdk-for-python/blob/master/tests/test_tableservice.py

    def _create_default_entity_dict(partition, row):
       # TODO: Edm.Binary and null
       return {'PartitionKey':partition,
              'RowKey':row,
              'age':39,
              'sex':'male',
              'married':True,
              'deceased':False,
              'optional':None,
              'ratio':3.1,
              'large':9333111000,
              'Birthday':datetime(1973,10,04),
              'birthday':datetime(1970,10,04),
              'binary':EntityProperty('Edm.Binary', None),
              'other':EntityProperty('Edm.Int64', 20),
              'clsid':EntityProperty('Edm.Guid', 'c9da6455-213d-42c9-9a79-3e9149a57833')}

    When read back the python type(data) returns <type 'datetime.datetime'>. But the DateTime is 1970-10-04 00:00:00 opposed to the expected 1970-10-04T00:00:00

    Is that a python print out idiom. Will clients written in other languages view the proper edm.DateTime

    Is the edm.DateTime stored as milliseconds. And is it possible to enter it as such.


    Thursday, November 28, 2013 6:02 PM

Answers