Using datajs (datajs-1.0.1.min.js) together with Azure Table Storage OData

Oct 5, 2011 at 2:12 PM

Using datajs (datajs-1.0.1.min.js) together with Azure Table Storage OData

I have tried to connect to Azure Table Storage with the datajs library using OData. I have passed the stage of generating the signature for Authorization: SharedKey but still ending in the error function of even though I receive the atom data because of "Cannot parse date/time value to given precision."

Any suggestions?

Oct 6, 2011 at 7:06 PM

Hi Senikk,

   Hope you are doing great.  Seems that the date/value is being delivered in a format that the library doesn't not entirely understand.  Could you please share with us a trace of the response so we can investigate further?


Alex Trigo.

Oct 6, 2011 at 11:26 PM

Here is the header part of the response:

HTTP/1.1 200 OK
Cache-Control: no-cache
Transfer-Encoding: chunked
Content-Type: application/atom+xml;charset=iso-8859-1
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 4024d865-8642-4f20-8ba1-579cf08153aa
x-ms-version: 2009-09-19
Date: Thu, 06 Oct 2011 22:17:55 GMT

And the feed body part:

<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?><feed xml:base="" xmlns:d="" xmlns:m="" xmlns="">  <title type="text">bruker</title>  <id></id>  <updated>2011-10-06T22:17:55Z</updated>  <link rel="self" title="bruker" href="bruker" />  <entry m:etag="W/&quot;datetime'2011-09-24T16%3A20%3A15.7724193Z'&quot;">    <id>'bruker',RowKey='AAAA')</id>    <title type="text"></title>    <updated>2011-10-06T22:17:55Z</updated>    <author>      <name />    </author>    <link rel="edit" title="bruker" href="bruker(PartitionKey='bruker',RowKey='AAAA')" />    <category term="paragraftilklasserom.bruker" scheme="" />    <content type="application/xml">      <m:properties>        <d:PartitionKey>bruker</d:PartitionKey>        <d:RowKey>AAAA</d:RowKey>        <d:Timestamp m:type="Edm.DateTime">2011-09-24T16:20:15.7724193Z</d:Timestamp>        <d:Brukernavn>senikk</d:Brukernavn>        <d:Passord>xxxx</d:Passord>      </m:properties>    </content>  </entry></feed>

Oct 7, 2011 at 7:27 PM
Edited Oct 7, 2011 at 8:05 PM
Hi Senikk, 

   Thanks for the trace.  The problem is with the precision of the timestamp property:

    <d:Timestamp m:type="Edm.DateTime">2011-09-24T16:20:15.7724193Z</d:Timestamp>

   As you can see, it has seven digits for the second fractions value.  The problem is that in javascript we cannot represent this value accurately because it only allows for second fractions up to milliseconds. The library errors out because of the data loss that this would cause.  Do you own the tables you are trying to access?  Can you reduce the precision of the timestamp field to use milliseconds instead? Or can you avoid selecting that property?


Alex Trigo.


Oct 9, 2011 at 8:45 PM

"Timestamp" is one of the needed fields in Windows Azure Table Storage which you can't do anything about. I got datajs working against Table Storage changing to the latest x-ms-version "2011-08-18" and DataServiceVersion and MaxDataServiceVersion to 2.0 which now support $select statement. :) But having to select every fields needed and not the Timestamp field feels a bit of work which shouldn't be needed to do. 

Terje :)

Oct 18, 2011 at 1:27 AM

Hi Terje,

Hope you are doing great.  We are fixing this issue so you can query against Table Storage without resorting to such painful workarounds. 


Alex Trigo.