The easiest way to map the Azure Data Warehouse data model in Node.js

When I want to add my javascript objects (or entities) to my Azure table storage, I first need to run them through entityGenerator.

My objects might look like this:

{
  id: 1,
  name: 'foo',
  timestamp: new Date()
}

The objects that I need to pass in TableServicewill look like this:

{
  id: { '_': 1, '$': 'Edm.Int32' },
  name: { '_': 'foo', '$': 'Edm.String' },
  timestamp:{ '_': new Date(), '$': 'Edm.DateTime' },
}

This is also the format in which objects are returned from TableService.

To match my objects with the correct format for sending them to the table store is pretty simple, but I haven’t found an easy way to convert the returned objects from my service back to regular JavaScript objects that I can easily work with.

mapper, _ , , .

- JavaScript Azure?

( ) azure-storage?

+4
1

Azure Storage SDK Node API . Azure Storage, SDK Rest API .

API, E.G. , , :

{
   "Address":"Mountain View",
   "Age":23,
   "AmountDue":200.23,
   "CustomerCode@odata.type":"Edm.Guid",
   "CustomerCode":"c9da6455-213d-42c9-9a79-3e9149a57833",
   "CustomerSince@odata.type":"Edm.DateTime",
   "CustomerSince":"2008-07-10T00:00:00",
   "IsActive":true,
   "NumberOfOrders@odata.type":"Edm.Int64",
   "NumberOfOrders":"255",
   "PartitionKey":"mypartitionkey",
   "RowKey":"myrowkey"
}

, .

, , , - SDK Azure Storage entityGenerator.

, , , .

-1

Source: https://habr.com/ru/post/1660089/


All Articles