Class: TableService

TableService

The TableService object allows you to peform management operations with the Microsoft Azure Table Service.
The Table Service stores data in rows of key-value pairs. A table is composed of multiple rows, and each row
contains key-value pairs. There is no schema, so each row in a table may store a different set of keys.

For more information on the Table Service, as well as task focused information on using it from a Node.js application, see
How to Use the Table Service from Node.js.
The following defaults can be set on the Table service.
defaultTimeoutIntervalInMs The default timeout interval, in milliseconds, to use for request made via the Table service.
defaultClientRequestTimeoutInMs The default timeout of client requests, in milliseconds, to use for the request made via the Table service.
defaultMaximumExecutionTimeInMs The default maximum execution time across all potential retries, for requests made via the Table service.
defaultLocationMode The default location mode for requests made via the Table service.
defaultPayloadFormat The default payload format for requests made via the Table service.
useNagleAlgorithm Determines whether the Nagle algorithm is used for requests made via the Table service.; true to use the
Nagle algorithm; otherwise, false. The default value is false.
enableGlobalHttpAgent Determines whether global HTTP(s) agent is enabled; true to use Global HTTP(s) agent; otherwise, false to use
http(s).Agent({keepAlive:true}).


new TableService( [storageAccountOrConnectionString] [, storageAccessKey] [, host] [, sasToken] [, endpointSuffix])

Creates a new TableService object.
If no connection string or storageaccount and storageaccesskey are provided,
the AZURE_STORAGE_CONNECTION_STRING or AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables will be used.

Parameters:
Name Type Argument Description
storageAccountOrConnectionString string <optional>

The storage account or the connection string.

storageAccessKey string <optional>

The storage access key.

host string | object <optional>

The host address. To define primary only, pass a string.
Otherwise 'host.primaryHost' defines the primary host and 'host.secondaryHost' defines the secondary host.

sasToken string <optional>

The Shared Access Signature token.

endpointSuffix string <optional>

The endpoint suffix.

Source:

Extends

Members


logger :Logger

The logger of the service. To change the log level of the services, set the logger.level.

Type:
Inherited From:
Source:

Methods


_getUrl()

Get the url of a given path

Inherited From:
Source:

_initializeLocation()

Initializes the location to which the operation is being sent to.

Inherited From:
Source:

_invalidLocationMode()

Checks whether we have the relevant host information based on the locationMode.

Inherited From:
Source:

_maximumExecutionTimeExceeded()

Checks to see if the maximum execution timeout provided has been exceeded.

Inherited From:
Source:

_setDefaultProxy()

Sets the service host default proxy from the environment.
Can be overridden by calling _setProxyUrl or _setProxy

Inherited From:
Source:

_setOperationExpiryTime()

Sets the operation expiry time.

Inherited From:
Source:

_validateLocation()

Validates the location to which the operation is being sent to.

Inherited From:
Source:

createTable(table [, options], callback)

Creates a new table within a storage account.

This:
Parameters:
Name Type Argument Description
table string

The table name.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the new table information.
response will contain information related to this operation.

Source:

createTableIfNotExists(table [, options], callback)

Creates a new table within a storage account if it does not exists.

This:
Parameters:
Name Type Argument Description
table string

The table name.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
result will contain the table information including created boolean member
response will contain information related to this operation.

Source:
Example
var azure = require('azure-storage');
var tableService = azure.createTableService();
tableService.createTableIfNotExists('tasktable', function(error) {
  if(!error) { 
    // Table created or exists
  }
});

deleteEntity(table, entityDescriptor [, options], callback)

Deletes an entity within a table. To delete conditionally based on etag, set entity['.metadata']['etag'].

This:
Parameters:
Name Type Argument Description
table string

The table name.

entityDescriptor object

The entity descriptor.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResponse

error will contain information if an error occurs;
response will contain information related to this operation.

Source:

deleteTable(table [, options], callback)

Deletes a table from a storage account.

This:
Parameters:
Name Type Argument Description
table string

The table name.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResponse

error will contain information if an error occurs;
response will contain information related to this operation.

Source:

deleteTableIfExists(table [, options], callback)

Deletes a table from a storage account, if it exists.

This:
Parameters:
Name Type Argument Description
table string

The table name.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
result will be true if table was deleted, false otherwise
response will contain information related to this operation.

Source:

doesTableExist(table [, options], callback)

Checks whether or not a table exists on the service.

This:
Parameters:
Name Type Argument Description
table string

The table name.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the table information including exists boolean member.
response will contain information related to this operation.

Source:

executeBatch(table, batch [, options], callback)

Executes the operations in the batch.

This:
Parameters:
Name Type Argument Description
table string

The table name.

batch TableBatch

The table batch to execute.

options object <optional>

The create options or callback function.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain responses for each operation executed in the batch;
result.entity will contain the entity information for each operation executed.
result.response will contain the response for each operations executed.
response will contain information related to this operation.

Source:

generateSharedAccessSignature(table, sharedAccessPolicy)

Retrieves a shared access signature token.

This:
Parameters:
Name Type Description
table string

The table name.

sharedAccessPolicy object

The shared access policy.

Properties
Name Type Argument Description
Id string <optional>

The signed identifier.

AccessPolicy.Permissions object <optional>

The permission type.

AccessPolicy.Start date | string <optional>

The time at which the Shared Access Signature becomes valid (The UTC value will be used).

AccessPolicy.Expiry date | string <optional>

The time at which the Shared Access Signature becomes expired (The UTC value will be used).

AccessPolicy.IPAddressOrRange string <optional>

An IP address or a range of IP addresses from which to accept requests. When specifying a range, note that the range is inclusive.

AccessPolicy.Protocols string <optional>

The protocols permitted for a request made with the account SAS.
Possible values are both HTTPS and HTTP (https,http) or HTTPS only (https). The default value is https,http.

AccessPolicy.StartPk string <optional>

The starting Partition Key for which the SAS will be valid.

AccessPolicy.EndPk string <optional>

The ending Partition Key for which the SAS will be valid.

AccessPolicy.StartRk string <optional>

The starting Row Key for which the SAS will be valid.

AccessPolicy.EndRk string <optional>

The ending Row Key for which the SAS will be valid.

Source:
Returns:

An object with the shared access signature.

Type
object

getServiceProperties( [options], callback)

Gets the properties of a storage account’s Table service, including Azure Storage Analytics.

This:
Parameters:
Name Type Argument Description
options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the properties.
response will contain information related to this operation.

Source:

getServiceStats( [options], callback)

Gets the service stats for a storage account’s Table service.

This:
Parameters:
Name Type Argument Description
options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the stats.
response will contain information related to this operation.

Source:

getTableAcl(table [, options], callback)

Gets the table's ACL.

This:
Parameters:
Name Type Argument Description
table string

The table name.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the ACL information for the table. See AccessPolicy for detailed information.
response will contain information related to this operation.

Source:

getUrl(table [, sasToken] [, primary])

Retrieves a table URL.

Parameters:
Name Type Argument Description
table string

The table name.

sasToken string <optional>

The Shared Access Signature token.

primary boolean <optional>

A boolean representing whether to use the primary or the secondary endpoint.

Source:
Returns:

The formatted URL string.

Type
string
Example
var azure = require('azure-storage');
var tableService = azure.createTableService();
var sharedAccessPolicy = {
  AccessPolicy: {
    Permissions: azure.TableUtilities.SharedAccessPermissions.QUERY,
    Start: startDate,
    Expiry: expiryDate
  },
};

var sasToken = tableService.generateSharedAccessSignature(table, sharedAccessPolicy);
var sasUrl = tableService.getUrl(table, sasToken);

insertEntity(table, entityDescriptor [, options], callback)

Inserts a new entity into a table.

This:
Parameters:
Name Type Argument Description
table string

The table name.

entityDescriptor object

The entity descriptor.

options object <optional>

The request options.

Properties
Name Type Argument Description
echoContent string <optional>

Whether or not to return the entity upon a successful insert. Default to false.

payloadFormat string <optional>

The payload format to use in the response, if options.echoContent is true.

locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

propertyResolver TableService~propertyResolver <optional>

The property resolver. Only applied if echoContent is true. Given the partition key, row key, property name,
property value, and the property Edm type if given by the service, returns the Edm type of the property.

entityResolver function <optional>

The entity resolver. Only applied if echoContent is true. Given the single entity returned by the insert, returns
a modified object.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the entity information.
response will contain information related to this operation.

Source:
Example
var azure = require('azure-storage');
var tableService = azure.createTableService();
var task1 = {
  PartitionKey : {'_': 'tasksSeattle', '$':'Edm.String'},
  RowKey: {'_': '1', '$':'Edm.String'},
  Description: {'_': 'Take out the trash', '$':'Edm.String'},
  DueDate: {'_': new Date(2011, 12, 14, 12), '$':'Edm.DateTime'}
};
tableService.insertEntity('tasktable', task1, function(error) {
  if(!error) {
    // Entity inserted
  }
}); 

insertOrMergeEntity(table, entityDescriptor [, options], callback)

Inserts or updates an existing entity within a table by merging new property values into the entity.

This:
Parameters:
Name Type Argument Description
table string

The table name.

entityDescriptor object

The entity descriptor.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the entity information.
response will contain information related to this operation.

Source:

insertOrReplaceEntity(table, entityDescriptor [, options], callback)

Inserts or updates a new entity into a table.

This:
Parameters:
Name Type Argument Description
table string

The table name.

entityDescriptor object

The entity descriptor.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the entity information.
response will contain information related to this operation.

Source:

listTablesSegmented(currentToken [, options], callback)

Lists a segment containing a collection of table items under the specified account.

This:
Parameters:
Name Type Argument Description
currentToken object

A continuation token returned by a previous listing operation. Please use 'null' or 'undefined' if this is the first operation.

options object <optional>

The create options or callback function.

Properties
Name Type Argument Description
maxResults int <optional>

Specifies the maximum number of tables to return per call to Azure ServiceClient.

locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

payloadFormat string <optional>

The payload format to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain entries and continuationToken.
entries gives a list of tables and the continuationToken is used for the next listing operation.
response will contain information related to this operation.

Source:

listTablesSegmentedWithPrefix(prefix, currentToken [, options], callback)

Lists a segment containing a collection of table items under the specified account.

This:
Parameters:
Name Type Argument Description
prefix string

The prefix of the table name.

currentToken object

A continuation token returned by a previous listing operation. Please use 'null' or 'undefined' if this is the first operation.

options object <optional>

The create options or callback function.

Properties
Name Type Argument Description
maxResults int <optional>

Specifies the maximum number of tables to return per call to Azure ServiceClient.

locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

payloadFormat string <optional>

The payload format to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain entries and continuationToken.
entries gives a list of tables and the continuationToken is used for the next listing operation.
response will contain information related to this operation.

Source:

mergeEntity(table, entityDescriptor [, options], callback)

Updates an existing entity within a table by merging new property values into the entity. To merge conditionally based on etag, set entity['.metadata']['etag'].

This:
Parameters:
Name Type Argument Description
table string

The table name.

entityDescriptor object

The entity descriptor.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the entity information.
response` will contain information related to this operation.

Source:

queryEntities(table, tableQuery, currentToken [, options], callback)

Queries data in a table. To retrieve a single entity by partition key and row key, use retrieve entity.

This:
Parameters:
Name Type Argument Description
table string

The table name.

tableQuery TableQuery

The query to perform. Use null, undefined, or new TableQuery() to get all of the entities in the table.

currentToken object

A continuation token returned by a previous listing operation.
Please use 'null' or 'undefined' if this is the first operation.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

payloadFormat string <optional>

The payload format to use for the request.

autoResolveProperties bool <optional>

If true, guess at all property types.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

entityResolver function <optional>

The entity resolver. Given a single entity returned by the query, returns a modified object which is added to
the entities array.

propertyResolver TableService~propertyResolver <optional>

The property resolver. Given the partition key, row key, property name, property value,
and the property Edm type if given by the service, returns the Edm type of the property.

callback TableService~queryResponse

error will contain information if an error occurs;
otherwise entries will contain the entities returned by the query.
If more matching entities exist, and could not be returned,
queryResultContinuation will contain a continuation token that can be used
to retrieve the next set of results.
response will contain information related to this operation.

The logic for returning entity types can get complicated. Here is the algorithm used:

var propertyType;

if (propertyResovler) {                      // If the caller provides a propertyResolver in the options, use it
  propertyType = propertyResolver(partitionKey, rowKey, propertyName, propertyValue, propertyTypeFromService);
} else if (propertyTypeFromService) {        // If the service provides us a property type, use it.  See below for an explanation of when this will and won't occur.
  propertyType = propertyTypeFromService;
} else if (autoResolveProperties) {          // If options.autoResolveProperties is set to true
  if (javascript type is string) {           // See below for an explanation of how and why autoResolveProperties works as it does.
    propertyType = 'Edm.String';
  } else if (javascript type is boolean) {
    propertyType = 'Edm.Boolean';
  }
}

if (propertyType) {
  // Set the property type on the property.
} else {
  // Property gets no EdmType. 
}

Notes:

  • The service only provides a type if JsonFullMetadata or JsonMinimalMetadata is used, and if the type is Int64, Guid, Binary, or DateTime.
  • Explanation of autoResolveProperties:
    • String gets correctly resolved to 'Edm.String'.
    • Int64, Guid, Binary, and DateTime all get resolved to 'Edm.String.' This only happens if JsonNoMetadata is used (otherwise the service will provide the propertyType in a prior step).
    • Boolean gets correctly resolved to 'Edm.Boolean'.
    • For both Int32 and Double, no type information is returned, even in the case of autoResolveProperties = true. This is due to an
      inability to distinguish between the two in certain cases.
Source:
Example
var azure = require('azure-storage');
var tableService = azure.createTableService();
// tasktable should already exist and have entities

// returns all entities in tasktable, and a continuation token for the next page of results if necessary
tableService.queryEntities('tasktable', null, null \/*currentToken*\/, function(error, result) {
  if(!error) { 
    var entities = result.entries;
    // do stuff with the returned entities if there are any
  }
});

// returns field1 and field2 of the entities in tasktable, and a continuation token for the next page of results if necessary
var tableQuery = new TableQuery().select('field1', 'field2');
tableService.queryEntities('tasktable', tableQuery, null \/*currentToken*\/, function(error, result) {
  if(!error) { 
    var entities = result.entries;
    // do stuff with the returned entities if there are any
  }
});

replaceEntity(table, entityDescriptor [, options], callback)

Replaces an existing entity within a table. To replace conditionally based on etag, set entity['.metadata']['etag'].

This:
Parameters:
Name Type Argument Description
table string

The table name.

entityDescriptor object

The entity descriptor.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain the entity information.
response will contain information related to this operation.

Source:

retrieveEntity(table, partitionKey, rowKey [, options], callback)

Retrieves an entity from a table.

This:
Parameters:
Name Type Argument Description
table string

The table name.

partitionKey string

The partition key.

rowKey string

The row key.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

payloadFormat string <optional>

The payload format to use for the request.

autoResolveProperties bool <optional>

If true, guess at all property types.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

propertyResolver TableService~propertyResolver <optional>

The property resolver. Given the partition key, row key, property name, property value,
and the property Edm type if given by the service, returns the Edm type of the property.

entityResolver function <optional>

The entity resolver. Given the single entity returned by the query, returns a modified object.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will be the matching entity.
response will contain information related to this operation.

The logic for returning entity types can get complicated. Here is the algorithm used:

var propertyType;

if (propertyResovler) {                      // If the caller provides a propertyResolver in the options, use it
  propertyType = propertyResolver(partitionKey, rowKey, propertyName, propertyValue, propertyTypeFromService);
} else if (propertyTypeFromService) {        // If the service provides us a property type, use it.  See below for an explanation of when this will and won't occur.
  propertyType = propertyTypeFromService;
} else if (autoResolveProperties) {          // If options.autoResolveProperties is set to true
  if (javascript type is string) {           // See below for an explanation of how and why autoResolveProperties works as it does.
    propertyType = 'Edm.String';
  } else if (javascript type is boolean) {
    propertyType = 'Edm.Boolean';
  }
}

if (propertyType) {
  // Set the property type on the property.
} else {
  // Property gets no EdmType. 
}

Notes:

  • The service only provides a type if JsonFullMetadata or JsonMinimalMetadata is used, and if the type is Int64, Guid, Binary, or DateTime.
  • Explanation of autoResolveProperties:
    • String gets correctly resolved to 'Edm.String'.
    • Int64, Guid, Binary, and DateTime all get resolved to 'Edm.String.' This only happens if JsonNoMetadata is used (otherwise the service will provide the propertyType in a prior step).
    • Boolean gets correctly resolved to 'Edm.Boolean'.
    • For both Int32 and Double, no type information is returned, even in the case of autoResolveProperties = true. This is due to an
      inability to distinguish between the two in certain cases.
Source:
Example
var azure = require('azure-storage');
var tableService = azure.createTableService();
tableService.retrieveEntity('tasktable', 'tasksSeattle', '1', function(error, serverEntity) {
  if(!error) {
    // Entity available in serverEntity variable
  }
});

setAccountServiceProperties(serviceProperties [, options], callback)

Sets the properties of a storage account’s service, including Azure Storage Analytics.
You can also use this operation to set the default request version for all incoming requests that do not have a version specified.

This:
Parameters:
Name Type Argument Description
serviceProperties object

The service properties.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResponse

error will contain information
if an error occurs; otherwise, response
will contain information related to this operation.

Inherited From:
Source:

setProxy(proxy)

Sets proxy object specified by caller.

Parameters:
Name Type Description
proxy object

proxy to use for tunneling
{
host: hostname
port: port number
proxyAuth: 'user:password' for basic auth
headers: {...} headers for proxy server
key: key for proxy server
ca: ca for proxy server
cert: cert for proxy server
}
if null or undefined, clears proxy

Inherited From:
Source:

setServiceProperties(serviceProperties [, options], callback)

Sets the properties of a storage account’s Table service, including Azure Storage Analytics.
You can also use this operation to set the default request version for all incoming requests that do not have a version specified.

This:
Parameters:
Name Type Argument Description
serviceProperties object

The service properties.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResponse

error will contain information if an error occurs;
response will contain information related to this operation.

Source:

setTableAcl(table, signedIdentifiers [, options], callback)

Updates the table's ACL.

This:
Parameters:
Name Type Argument Description
table string

The table name.

signedIdentifiers Object.<string, AccessPolicy>

The table ACL settings. See AccessPolicy for detailed information.

options object <optional>

The request options.

Properties
Name Type Argument Description
locationMode LocationMode <optional>

Specifies the location mode used to decide which location the request should be sent to.
Please see StorageUtilities.LocationMode for the possible values.

timeoutIntervalInMs int <optional>

The server timeout interval, in milliseconds, to use for the request.

clientRequestTimeoutInMs int <optional>

The timeout of client requests, in milliseconds, to use for the request.

maximumExecutionTimeInMs int <optional>

The maximum execution time, in milliseconds, across all potential retries, to use when making this request.
The maximum execution time interval begins at the time that the client begins building the request. The maximum
execution time is checked intermittently while performing requests, and before executing retries.

clientRequestId string <optional>

A string that represents the client request ID with a 1KB character limit.

useNagleAlgorithm bool <optional>

Determines whether the Nagle algorithm is used; true to use the Nagle algorithm; otherwise, false.
The default value is false.

callback errorOrResult

error will contain information if an error occurs;
otherwise result will contain information for the table.
response will contain information related to this operation.

Source:

withFilter(filter)

Associate a filtering operation with this StorageServiceClient. Filtering operations
can include logging, automatically retrying, etc. Filter operations are objects
that implement a method with the signature:

"function handle (requestOptions, next)".

After doing its preprocessing on the request options, the method needs to call
"next" passing a callback with the following signature:
signature:

"function (returnObject, finalCallback, next)"

In this callback, and after processing the returnObject (the response from the
request to the server), the callback needs to either invoke next if it exists to
continue processing other filters or simply invoke finalCallback otherwise to end
up the service invocation.

Parameters:
Name Type Description
filter Object

The new filter object.

Inherited From:
Source:
Returns:

A new service client with the filter applied.

Type
StorageServiceClient

Type Definitions


propertyResolver(pk, rk, name, value, type)

Given the partition key, row key, property name, property value,
and the property Edm type if given by the service, returns the Edm type of the property.

Parameters:
Name Type Description
pk object

The partition key.

rk object

The row key.

name string

The property name.

value object

The property value.

type string

The EDM type.

Source:

queryResponse(error, entries, queryResultContinuation, response)

Returns entities matched by a query.

Parameters:
Name Type Description
error object

If an error occurs, the error information.

entries object

The entities returned by the query.

queryResultContinuation object

If more matching entities exist, and could not be returned,
a continuation token that can be used to retrieve more results.

response object

Information related to this operation.

Source: