azure.data.tables package

class azure.data.tables.TableClient(account_url: str, table_name: str, credential: Union[str, TokenCredential] = None, **kwargs: Any)[source]
Variables

account_name (str) – Name of the storage account (Cosmos or Azure)

Create TableClient from a Credential.

Parameters
  • account_url (str) – A url to an Azure Storage account.

  • table_name (str) – The table name.

  • credential (Union[str,TokenCredential]) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string, an account shared access key, or an instance of a TokenCredentials class from azure.identity.

Returns

None

close()

This method is to close the sockets opened by the client. It need not be used when using with a context manager.

create_entity(entity: Union[TableEntity, Dict[str, str]], **kwargs: Any) → Dict[str, str][source]

Insert entity in a table.

Parameters

entity (Union[TableEntity, dict[str,str]]) – The properties for the table entity.

Returns

Dictionary mapping operation metadata returned from the service

Return type

dict[str,str]

Raises

~azure.core.exceptions.HttpResponseError

Example:

Creating and adding an entity to a Table
try:
    entity = table_client.create_entity(entity=self.entity)
    print(entity)
except ResourceExistsError:
    print("Entity already exists")
create_table(**kwargs: Any) → Dict[str, str][source]

Creates a new table under the current account.

Returns

Dictionary of operation metadata returned from service

Return type

dict[str,str]

Raises

~azure.core.exceptions.HttpResponseError

Example:

Creating a table from the TableClient object
table_client = TableClient.from_connection_string(
    conn_str=self.connection_string,
    table_name=self.table_name
)
try:
    table_item = table_client.create_table()
    print("Created table {}!".format(table_item.table_name))
except ResourceExistsError:
    print("Table already exists")
delete_entity(partition_key: str, row_key: str, **kwargs: Any)None[source]

Deletes the specified entity in a table.

Parameters
  • partition_key (str) – The partition key of the entity.

  • row_key (str) – The row key of the entity.

Keyword Arguments
Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

Example:

Deleting an entity to a Table
try:
    table_client.delete_entity(
        row_key=self.entity["RowKey"],
        partition_key=self.entity["PartitionKey"]
    )
    print("Successfully deleted!")
except ResourceNotFoundError:
    print("Entity does not exists")
delete_table(**kwargs: Any)None[source]

Deletes the table under the current account.

Returns

None

Return type

None

Example:

Deleting a table from the TableClient object
table_client = TableClient.from_connection_string(
    conn_str=self.connection_string,
    table_name=self.table_name
)
try:
    table_client.delete_table()
    print("Deleted table {}!".format(self.table_name))
except ResourceNotFoundError:
    print("Table could not be found")
classmethod from_connection_string(conn_str: str, table_name: str, **kwargs: Any) → azure.data.tables._table_client.TableClient[source]

Create TableClient from a Connection String.

Parameters
  • conn_str (str) – A connection string to an Azure Storage or Cosmos account.

  • table_name (str) – The table name.

Returns

A table client.

Return type

TableClient

Example:

Authenticating a TableServiceClient from a connection_string
from azure.data.tables import TableClient
table_client = TableClient.from_connection_string(
    conn_str=self.connection_string,
    table_name="tableName"
)
print("Table name: {}".format(table_client.table_name))
classmethod from_table_url(table_url: str, credential: Optional[Any] = None, **kwargs: Any) → azure.data.tables._table_client.TableClient[source]

A client to interact with a specific Table.

Parameters
  • table_url (str) – The full URI to the table, including SAS token if used.

  • credential (str) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be a SAS token string, an account shared access key.

Returns

A table client.

Return type

TableClient

get_entity(partition_key: str, row_key: str, **kwargs: Any) → Dict[str, str][source]

Queries entities in a table.

Parameters
  • partition_key (str) – The partition key of the entity.

  • row_key (str) – The row key of the entity.

Returns

Dictionary mapping operation metadata returned from the service

Return type

dict[str,str]

Raises

~azure.core.exceptions.HttpResponseError

get_table_access_policy(**kwargs: Any) → Dict[str, AccessPolicy][source]

Retrieves details about any stored access policies specified on the table that may be used with Shared Access Signatures.

Returns

Dictionary of SignedIdentifiers

Return type

dict[str,AccessPolicy]

Raises

~azure.core.exceptions.HttpResponseError

list_entities(**kwargs: Any)azure.core.paging.ItemPaged[azure.data.tables._entity.TableEntity][source]

Lists entities in a table.

Keyword Arguments
  • results_per_page (int) – Number of entities per page in return ItemPaged

  • list(str)] select (Union[str,) – Specify desired properties of an entity to return certain entities

Returns

Query of table entities

Return type

ItemPaged[TableEntity]

Raises

~azure.core.exceptions.HttpResponseError

Example:

List all entities held within a table
    # Query the entities in the table
    entities = list(table.list_entities())

    for i, entity in enumerate(entities):
        print("Entity #{}: {}".format(entity, i))
query_entities(filter: str, **kwargs)azure.core.paging.ItemPaged[azure.data.tables._entity.TableEntity][source]

Lists entities in a table.

Parameters

filter (str) – Specify a filter to return certain entities

Keyword Arguments
  • results_per_page (int) – Number of entities per page in return ItemPaged

  • list[str]] select (Union[str,) – Specify desired properties of an entity to return certain entities

  • parameters (dict) – Dictionary for formatting query with additional, user defined parameters

Returns

Query of table entities

Return type

ItemPaged[TableEntity]

Raises

~azure.core.exceptions.HttpResponseError

Example:

Query entities held within a table
try:
    entity_name = "marker"
    name_filter = "Name eq '{}'".format(entity_name)
    queried_entities = table_client.query_entities(filter=name_filter, select=["Brand","Color"])

    for entity_chosen in queried_entities:
        print(entity_chosen)

except HttpResponseError as e:
    print(e.message)
set_table_access_policy(signed_identifiers: Dict[str, AccessPolicy], **kwargs)None[source]

Sets stored access policies for the table that may be used with Shared Access Signatures.

Parameters

signed_identifiers (dict[str,AccessPolicy]) –

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

update_entity(entity: Union[TableEntity, Dict[str,str]], mode: UpdateMode = <UpdateMode.MERGE: 'merge'>, **kwargs: Any) → Dict[str, str][source]

Update entity in a table.

Parameters
Keyword Arguments
  • partition_key (str) – The partition key of the entity.

  • row_key (str) – The row key of the entity.

  • etag (str) – Etag of the entity

  • match_condition (MatchConditions) – MatchCondition

Returns

Dictionary mapping operation metadata returned from the service

Return type

dict[str,str]

Raises

~azure.core.exceptions.HttpResponseError

Example:

Updating an already exiting entity in a Table
    # Update the entity
    created.text = "NewMarker"
    table.update_entity(mode=UpdateMode.REPLACE, entity=created)

    # Get the replaced entity
    replaced = table.get_entity(
        partition_key=created.PartitionKey, row_key=created.RowKey)
    print("Replaced entity: {}".format(replaced))

    # Merge the entity
    replaced.color = "Blue"
    table.update_entity(mode=UpdateMode.MERGE, entity=replaced)

    # Get the merged entity
    merged = table.get_entity(
        partition_key=replaced.PartitionKey, row_key=replaced.RowKey)
    print("Merged entity: {}".format(merged))
upsert_entity(entity: Union[TableEntity, Dict[str,str]], mode: UpdateMode = <UpdateMode.MERGE: 'merge'>, **kwargs: Any) → Dict[str, str][source]

Update/Merge or Insert entity into table.

Parameters
Returns

Dictionary mapping operation metadata returned from the service

Return type

dict[str,str]

Raises

~azure.core.exceptions.HttpResponseError

Example:

Update/merge or insert an entity into a table
    # Try Replace and then Insert on Fail
    insert_entity = table.upsert_entity(mode=UpdateMode.REPLACE, entity=entity1)
    print("Inserted entity: {}".format(insert_entity))

    # Try merge, and merge since already in table
    created.text = "NewMarker"
    merged_entity = table.upsert_entity(mode=UpdateMode.MERGE, entity=entity)
    print("Merged entity: {}".format(merged_entity))
property api_version

The version of the Storage API used for requests.

Type

str

property location_mode

The location mode that the client is currently using.

By default this will be “primary”. Options include “primary” and “secondary”.

Type

str

property url

The full endpoint URL to this entity, including SAS token if used.

This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode().

class azure.data.tables.TableServiceClient(account_url: str, credential: Union[str, TokenCredential] = None, **kwargs: Any)[source]
Variables

account_name (str) – Name of the storage account (Cosmos or Azure)

Create TableServiceClient from a Credential.

Parameters
  • account_url (str) – A url to an Azure Storage account.

  • credential (str) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token, or the connection string already has shared access key values. The value can be a SAS token string, an account shared access key.

Returns

None

Example:

Authenticating a TableServiceClient from a Shared Access Key
# Create a SAS token to use for authentication of a client
from azure.data.tables import generate_account_sas, ResourceTypes, AccountSasPermissions
print(self.account_name)
sas_token = generate_account_sas(
    self.account_name,
    self.access_key,
    resource_types=ResourceTypes(service=True),
    permission=AccountSasPermissions(read=True),
    expiry=datetime.utcnow() + timedelta(hours=1)
)

token_auth_table_service = TableServiceClient(account_url=self.account_url, credential=sas_token)

properties = token_auth_table_service.get_service_properties()
print("Shared Access Signature: {}".format(properties))
Authenticating a TableServiceClient from a Shared Account Key
from azure.data.tables import TableServiceClient
table_service = TableServiceClient(account_url=self.account_url, credential=self.access_key)
properties = table_service.get_service_properties()
print("Shared Key: {}".format(properties))
close()

This method is to close the sockets opened by the client. It need not be used when using with a context manager.

create_table(table_name: str, **kwargs: Any) → azure.data.tables._table_client.TableClient[source]

Creates a new table under the current account.

Parameters

table_name (str) – The Table name.

Returns

TableClient

Return type

TableClient

Raises

~azure.core.exceptions.HttpResponseError

Example:

Creating a table from the TableServiceClient object
table_service_client = TableServiceClient.from_connection_string(self.connection_string)
try:
    table_item = table_service_client.create_table(table_name=self.table_name)
    print("Created table {}!".format(table_item.table_name))
except ResourceExistsError:
    print("Table already exists")
create_table_if_not_exists(table_name: str, **kwargs: Any) → azure.data.tables._table_client.TableClient[source]

Creates a new table if it does not currently exist. If the table currently exists, the current table is returned.

Parameters

table_name (str) – The Table name.

Returns

TableClient

Return type

TableClient

Raises

~azure.core.exceptions.HttpResponseError

Example:

Deleting a table from the TableServiceClient object
table_service_client = TableServiceClient.from_connection_string(self.connection_string)
table_item = TableServiceClient.create_table_if_not_exists(table_name=self.table_name)
print("Table name: {}".format(table_item.table_name))
delete_table(table_name: str, **kwargs: Any)None[source]

Deletes the table under the current account

Parameters

table_name (str) – The Table name.

Returns

None

Return type

None

Example:

Deleting a table from the TableServiceClient object
table_service_client = TableServiceClient.from_connection_string(self.connection_string)
try:
    table_service_client.delete_table(table_name=self.table_name)
    print("Deleted table {}!".format(self.table_name))
except ResourceNotFoundError:
    print("Table could not be found")
classmethod from_connection_string(conn_str: str, **kwargs: Any) → azure.data.tables._table_service_client.TableServiceClient[source]

Create TableServiceClient from a Connection String.

Parameters

conn_str (str) – A connection string to an Azure Storage or Cosmos account.

Returns

A Table service client.

Return type

TableServiceClient

Example:

Authenticating a TableServiceClient from a connection_string
from azure.data.tables import TableServiceClient
table_service = TableServiceClient.from_connection_string(conn_str=self.connection_string)
properties = table_service.get_service_properties()
print("Connection String: {}".format(properties))
get_service_properties(**kwargs)dict[str, Any][source]

Gets the properties of an account’s Table service, including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.

Returns

Dictionary of service properties

:rtype:dict[str, Any] :raises: ~azure.core.exceptions.HttpResponseError

get_service_stats(**kwargs)dict[str, object][source]

Retrieves statistics related to replication for the Table service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the account.

Returns

Dictionary of Service Stats

:rtype:dict[str, object] :raises: ~azure.core.exceptions.HttpResponseError

get_table_client(table_name: Union[TableProperties, str], **kwargs: Optional[Any]) → TableClient[source]

Get a client to interact with the specified table.

The table need not already exist.

Parameters

table_name (str) – The table name

Returns

A TableClient object.

Return type

TableClient

list_tables(**kwargs: Any)azure.core.paging.ItemPaged[azure.data.tables._models.TableItem][source]

Queries tables under the given account.

Keyword Arguments
  • results_per_page (int) – Number of tables per page in return ItemPaged

  • list(str)] select (Union[str,) – Specify desired properties of a table to return certain tables

Returns

A query of tables

Return type

ItemPaged[TableItem]

Raises

~azure.core.exceptions.HttpResponseError

Example:

Listing all tables in a storage account
    # List all the tables in the service
    list_tables = table_service.list_tables()
    print("Listing tables:")
    for table in list_tables:
        print("\t{}".format(table.table_name))
query_tables(filter, **kwargs: Any)azure.core.paging.ItemPaged[azure.data.tables._models.TableItem][source]

Queries tables under the given account. :param filter: Specify a filter to return certain tables :type filter: str :keyword int results_per_page: Number of tables per page in return ItemPaged :keyword Union[str, list(str)] select: Specify desired properties of a table to return certain tables :keyword dict parameters: Dictionary for formatting query with additional, user defined parameters :return: A query of tables :rtype: ItemPaged[TableItem] :raises: ~azure.core.exceptions.HttpResponseError

Example:

Querying tables in a storage account
    table_name = "mytable1"
    name_filter = "TableName eq '{}'".format(table_name)
    queried_tables = table_service.query_tables(filter=name_filter)

    print("Queried_tables")
    for table in queried_tables:
        print("\t{}".format(table.table_name))
set_service_properties(analytics_logging: Optional[TableAnalyticsLogging] = None, hour_metrics: Optional[Metrics] = None, minute_metrics: Optional[Metrics] = None, cors: Optional[CorsRule] = None, **kwargs: Any)None[source]
Sets properties for an account’s Table service endpoint,

including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.

Parameters
  • analytics_logging (TableAnalyticsLogging) – Properties for analytics

  • hour_metrics (Metrics) – Hour level metrics

  • minute_metrics (Metrics) – Minute level metrics

  • cors (CorsRule) – Cross-origin resource sharing rules

Returns

None

Return type

None

Raises

~azure.core.exceptions.HttpResponseError

property api_version

The version of the Storage API used for requests.

Type

str

property location_mode

The location mode that the client is currently using.

By default this will be “primary”. Options include “primary” and “secondary”.

Type

str

property url

The full endpoint URL to this entity, including SAS token if used.

This could be either the primary endpoint, or the secondary endpoint depending on the current location_mode().

class azure.data.tables.ExponentialRetry(initial_backoff=15, increment_base=3, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs)[source]

Exponential retry.

Constructs an Exponential retry object. The initial_backoff is used for the first retry. Subsequent retries are retried after initial_backoff + increment_power^retry_count seconds. For example, by default the first retry occurs after 15 seconds, the second after (15+3^1) = 18 seconds, and the third after (15+3^2) = 24 seconds.

Parameters
  • initial_backoff (int) – The initial backoff interval, in seconds, for the first retry.

  • increment_base (int) – The base, in seconds, to increment the initial_backoff by after the first retry.

  • max_attempts (int) – The maximum number of retry attempts.

  • retry_total (int) – total number of retries

  • retry_to_secondary (bool) – Whether the request should be retried to secondary, if able. This should only be enabled of RA-GRS accounts are used and potentially stale data can be handled.

  • random_jitter_range (int) – A number in seconds which indicates a range to jitter/randomize for the back-off interval. For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3.

configure_retries(request)dict
Parameters
  • request (Any) –

  • kwargs

Returns

:rtype:dict

get_backoff_time(settings)[source]

Calculates how long to sleep before retrying. :param dict settings: :keyword callable cls: A custom type or function that will be passed the direct response :return:

An integer indicating how long to wait before retrying the request, or None to indicate no retry should be performed.

Return type

int or None

get_retry_after(response)

Get the value of Retry-After in seconds.

Parameters

response (PipelineResponse) – The PipelineResponse object

Returns

Value of Retry-After in seconds.

Return type

float or None

increment(settings, request, response=None, error=None, **kwargs)None

Increment the retry counters.

Parameters
  • request (Any) –

  • settings (dict) –

  • response (Any) – A pipeline response object.

  • error (Any) – An error encountered during the request, or None if the response was received successfully.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

Whether the retry attempts are exhausted.

Return type

None

is_exhausted(settings)

Checks if any retries left.

Parameters

settings (dict) – the retry settings

Returns

False if have more retries. True if retries exhausted.

Return type

bool

is_retry(settings, response)

Checks if method/status code is retryable.

Based on whitelists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the returned status code is on the list of status codes to be retried upon on the presence of the aforementioned header.

The behavior is: - If status_code < 400: don’t retry - Else if Retry-After present: retry - Else: retry based on the safe status code list ([408, 429, 500, 502, 503, 504])

Parameters
  • settings (dict) – The retry settings.

  • response (PipelineResponse) – The PipelineResponse object

Returns

True if method/status code is retryable. False if not retryable.

Return type

bool

classmethod no_retries()

Disable retries.

parse_retry_after(retry_after)

Helper to parse Retry-After and get value in seconds.

Parameters

retry_after (str) – Retry-After header

Return type

float

send(request)
Parameters

request (Any) –

Returns

None

sleep(settings, transport)None
Parameters
  • settings (Any) –

  • transport (Any) –

:return:None

update_context(context, retry_settings)

Updates retry history in pipeline context.

Parameters
  • context (PipelineContext) – The pipeline context.

  • retry_settings (dict) – The retry settings.

BACKOFF_MAX = 120
class azure.data.tables.LinearRetry(backoff=15, retry_total=3, retry_to_secondary=False, random_jitter_range=3, **kwargs)[source]

Linear retry.

Constructs a Linear retry object.

Parameters
  • backoff (int) – The backoff interval, in seconds, between retries.

  • max_attempts (int) – The maximum number of retry attempts.

  • retry_to_secondary (bool) – Whether the request should be retried to secondary, if able. This should only be enabled of RA-GRS accounts are used and potentially stale data can be handled.

  • retry_total (int) – total number of retries

  • random_jitter_range (int) – A number in seconds which indicates a range to jitter/randomize for the back-off interval. For example, a random_jitter_range of 3 results in the back-off interval x to vary between x+3 and x-3.

configure_retries(request)dict
Parameters
  • request (Any) –

  • kwargs

Returns

:rtype:dict

get_backoff_time(settings)[source]

Calculates how long to sleep before retrying.

Parameters

settings (dict) –

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

An integer indicating how long to wait before retrying the request, or None to indicate no retry should be performed.

Return type

int or None

get_retry_after(response)

Get the value of Retry-After in seconds.

Parameters

response (PipelineResponse) – The PipelineResponse object

Returns

Value of Retry-After in seconds.

Return type

float or None

increment(settings, request, response=None, error=None, **kwargs)None

Increment the retry counters.

Parameters
  • request (Any) –

  • settings (dict) –

  • response (Any) – A pipeline response object.

  • error (Any) – An error encountered during the request, or None if the response was received successfully.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

Whether the retry attempts are exhausted.

Return type

None

is_exhausted(settings)

Checks if any retries left.

Parameters

settings (dict) – the retry settings

Returns

False if have more retries. True if retries exhausted.

Return type

bool

is_retry(settings, response)

Checks if method/status code is retryable.

Based on whitelists and control variables such as the number of total retries to allow, whether to respect the Retry-After header, whether this header is present, and whether the returned status code is on the list of status codes to be retried upon on the presence of the aforementioned header.

The behavior is: - If status_code < 400: don’t retry - Else if Retry-After present: retry - Else: retry based on the safe status code list ([408, 429, 500, 502, 503, 504])

Parameters
  • settings (dict) – The retry settings.

  • response (PipelineResponse) – The PipelineResponse object

Returns

True if method/status code is retryable. False if not retryable.

Return type

bool

classmethod no_retries()

Disable retries.

parse_retry_after(retry_after)

Helper to parse Retry-After and get value in seconds.

Parameters

retry_after (str) – Retry-After header

Return type

float

send(request)
Parameters

request (Any) –

Returns

None

sleep(settings, transport)None
Parameters
  • settings (Any) –

  • transport (Any) –

:return:None

update_context(context, retry_settings)

Updates retry history in pipeline context.

Parameters
  • context (PipelineContext) – The pipeline context.

  • retry_settings (dict) – The retry settings.

BACKOFF_MAX = 120
class azure.data.tables.LocationMode[source]

Specifies the location the request should be sent to. This mode only applies for RA-GRS accounts which allow secondary read access. All other account types must use PRIMARY.

PRIMARY = 'primary'

Requests should be sent to the primary location.

SECONDARY = 'secondary'

Requests should be sent to the secondary location, if possible.

class azure.data.tables.ResourceTypes(service=False, object=False)[source]

Specifies the resource types that are accessible with the account SAS.

Parameters
  • service (bool) – Access to service-level APIs (e.g., Get/Set Service Properties, Get Service Stats, List Containers/Queues/Shares)

  • object (bool) – Access to object-level APIs for blobs, queue messages, and files(e.g. Put Blob, Query Entity, Get Messages, Create File, etc.)

classmethod from_string(string)[source]

Create a ResourceTypes from a string.

To specify service, container, or object you need only to include the first letter of the word in the string. E.g. service and container, you would provide a string “sc”.

Parameters

string (str) – Specify service, container, or object in in the string with the first letter of the word.

Returns

A ResourceTypes object

Return type

ResourceTypes

class azure.data.tables.AccountSasPermissions(**kwargs)[source]

ResourceTypes class to be used with generate_account_sas function and for the AccessPolicies used with set_*_acl. There are two types of SAS which may be used to grant resource access. One is to grant access to a specific resource (resource-specific). Another is to grant access to the entire service for a specific account and allow certain operations based on perms found here.

Variables
  • read (bool) – Valid for all signed resources types (Service, Container, and Object). Permits read permissions to the specified resource type.

  • write (bool) – Valid for all signed resources types (Service, Container, and Object). Permits write permissions to the specified resource type.

  • delete (bool) – Valid for Container and Object resource types, except for queue messages.

  • list (bool) – Valid for Service and Container resource types only.

  • add (bool) – Valid for the following Object resource types only: queue messages, and append blobs.

  • create (bool) – Valid for the following Object resource types only: blobs and files. Users can create new blobs or files, but may not overwrite existing blobs or files.

  • update (bool) – Valid for the following Object resource types only: queue messages.

  • process (bool) – Valid for the following Object resource type only: queue messages.

classmethod from_string(permission, **kwargs)[source]

Create AccountSasPermissions from a string.

To specify read, write, delete, etc. permissions you need only to include the first letter of the word in the string. E.g. for read and write permissions you would provide a string “rw”.

Parameters

permission (str) – Specify permissions in the string with the first letter of the word.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

A AccountSasPermissions object

Return type

AccountSasPermissions

class azure.data.tables.TableErrorCode[source]

An enumeration.

account_already_exists = 'AccountAlreadyExists'
account_being_created = 'AccountBeingCreated'
account_is_disabled = 'AccountIsDisabled'
authentication_failed = 'AuthenticationFailed'
authorization_failure = 'AuthorizationFailure'
condition_headers_not_supported = 'ConditionHeadersNotSupported'
condition_not_met = 'ConditionNotMet'
duplicate_properties_specified = 'DuplicatePropertiesSpecified'
empty_metadata_key = 'EmptyMetadataKey'
entity_already_exists = 'EntityAlreadyExists'
entity_not_found = 'EntityNotFound'
entity_too_large = 'EntityTooLarge'
host_information_not_present = 'HostInformationNotPresent'
insufficient_account_permissions = 'InsufficientAccountPermissions'
internal_error = 'InternalError'
invalid_authentication_info = 'InvalidAuthenticationInfo'
invalid_duplicate_row = 'InvalidDuplicateRow'
invalid_header_value = 'InvalidHeaderValue'
invalid_http_verb = 'InvalidHttpVerb'
invalid_input = 'InvalidInput'
invalid_md5 = 'InvalidMd5'
invalid_metadata = 'InvalidMetadata'
invalid_query_parameter_value = 'InvalidQueryParameterValue'
invalid_range = 'InvalidRange'
invalid_resource_name = 'InvalidResourceName'
invalid_uri = 'InvalidUri'
invalid_value_type = 'InvalidValueType'
invalid_xml_document = 'InvalidXmlDocument'
invalid_xml_node_value = 'InvalidXmlNodeValue'
json_format_not_supported = 'JsonFormatNotSupported'
md5_mismatch = 'Md5Mismatch'
metadata_too_large = 'MetadataTooLarge'
method_not_allowed = 'MethodNotAllowed'
missing_content_length_header = 'MissingContentLengthHeader'
missing_required_header = 'MissingRequiredHeader'
missing_required_query_parameter = 'MissingRequiredQueryParameter'
missing_required_xml_node = 'MissingRequiredXmlNode'
multiple_condition_headers_not_supported = 'MultipleConditionHeadersNotSupported'
no_authentication_information = 'NoAuthenticationInformation'
not_implemented = 'NotImplemented'
operation_timed_out = 'OperationTimedOut'
out_of_range_input = 'OutOfRangeInput'
out_of_range_query_parameter_value = 'OutOfRangeQueryParameterValue'
properties_need_value = 'PropertiesNeedValue'
property_name_invalid = 'PropertyNameInvalid'
property_name_too_long = 'PropertyNameTooLong'
property_value_too_large = 'PropertyValueTooLarge'
request_body_too_large = 'RequestBodyTooLarge'
request_url_failed_to_parse = 'RequestUrlFailedToParse'
resource_already_exists = 'ResourceAlreadyExists'
resource_not_found = 'ResourceNotFound'
resource_type_mismatch = 'ResourceTypeMismatch'
server_busy = 'ServerBusy'
table_already_exists = 'TableAlreadyExists'
table_being_deleted = 'TableBeingDeleted'
table_not_found = 'TableNotFound'
too_many_properties = 'TooManyProperties'
unsupported_header = 'UnsupportedHeader'
unsupported_http_verb = 'UnsupportedHttpVerb'
unsupported_query_parameter = 'UnsupportedQueryParameter'
unsupported_xml_node = 'UnsupportedXmlNode'
update_condition_not_satisfied = 'UpdateConditionNotSatisfied'
x_method_incorrect_count = 'XMethodIncorrectCount'
x_method_incorrect_value = 'XMethodIncorrectValue'
x_method_not_using_post = 'XMethodNotUsingPost'
class azure.data.tables.TableServiceStats(geo_replication=None, **kwargs)[source]

Stats for the service :param geo_replication: Geo-Replication information for the Secondary Storage Service. :type geo_replication: ~azure_table.models.GeoReplication

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.data.tables.TableSasPermissions(_str: str = None, **kwargs: Any)[source]
Keyword Arguments
  • read (bool) – Get entities and query entities.

  • add (bool) – Add entities. Add and Update permissions are required for upsert operations.

  • update (bool) – Update entities. Add and Update permissions are required for upsert operations.

  • delete (bool) – Delete entities.

Parameters

_str (str) – A string representing the permissions.

classmethod from_string(permission, **kwargs)[source]

Create AccountSasPermissions from a string.

To specify read, write, delete, etc. permissions you need only to include the first letter of the word in the string. E.g. for read and write permissions you would provide a string “rw”.

Parameters

permission (str) – Specify permissions in the string with the first letter of the word.

Keyword Arguments

cls (callable) – A custom type or function that will be passed the direct response

Returns

A AccountSasPermissions object

Return type

AccountSasPermissions

ADD = <azure.data.tables._models.TableSasPermissions object>
DELETE = <azure.data.tables._models.TableSasPermissions object>
READ = <azure.data.tables._models.TableSasPermissions object>
UPDATE = <azure.data.tables._models.TableSasPermissions object>
class azure.data.tables.AccessPolicy(permission=None, expiry=None, start=None, **kwargs)[source]

Access Policy class used by the set and get access policy methods.

A stored access policy can specify the start time, expiry time, and permissions for the Shared Access Signatures with which it’s associated. Depending on how you want to control access to your resource, you can specify all of these parameters within the stored access policy, and omit them from the URL for the Shared Access Signature. Doing so permits you to modify the associated signature’s behavior at any time, as well as to revoke it. Or you can specify one or more of the access policy parameters within the stored access policy, and the others on the URL. Finally, you can specify all of the parameters on the URL. In this case, you can use the stored access policy to revoke the signature, but not to modify its behavior.

Together the Shared Access Signature and the stored access policy must include all fields required to authenticate the signature. If any required fields are missing, the request will fail. Likewise, if a field is specified both in the Shared Access Signature URL and in the stored access policy, the request will fail with status code 400 (Bad Request).

Parameters
  • permission (str) – The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy.

  • expiry (datetime or str) – The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

  • start (datetime or str) – The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.data.tables.TableAnalyticsLogging(**kwargs: Any)[source]

Azure Analytics Logging settings.

All required parameters must be populated in order to send to Azure.

Keyword Arguments
  • version (str) – Required. The version of Storage Analytics to configure.

  • delete (bool) – Required. Indicates whether all delete requests should be logged.

  • read (bool) – Required. Indicates whether all read requests should be logged.

  • write (bool) – Required. Indicates whether all write requests should be logged.

  • retention_policy (RetentionPolicy) – Required. The retention policy for the metrics.

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.data.tables.Metrics(**kwargs)[source]

A summary of request statistics grouped by API in hour or minute aggregates.

All required parameters must be populated in order to send to Azure.

Keyword Arguments
  • version (str) – The version of Storage Analytics to configure.

  • enabled (bool) – Required. Indicates whether metrics are enabled for the service.

  • include_ap_is (bool) – Indicates whether metrics should generate summary statistics for called API operations.

  • retention_policy (RetentionPolicy) – Required. The retention policy for the metrics.

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.data.tables.CorsRule(allowed_origins: list[str], allowed_methods: list[str], **kwargs: Any)[source]

CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.

All required parameters must be populated in order to send to Azure.

Parameters
  • allowed_origins (list[str]) – A list of origin domains that will be allowed via CORS, or “*” to allow all domains. The list of must contain at least one entry. Limited to 64 origin domains. Each allowed origin can have up to 256 characters.

  • allowed_methods (list[str]) – A list of HTTP methods that are allowed to be executed by the origin. The list of must contain at least one entry. For Azure Storage, permitted methods are DELETE, GET, HEAD, MERGE, POST, OPTIONS or PUT.

Keyword Arguments
  • max_age_in_seconds (int) – The number of seconds that the client/browser should cache a pre-flight response.

  • exposed_headers (list[str]) – Defaults to an empty list. A list of response headers to expose to CORS clients. Limited to 64 defined headers and two prefixed headers. Each header can be up to 256 characters.

  • allowed_headers (list[str]) – Defaults to an empty list. A list of headers allowed to be part of the cross-origin request. Limited to 64 defined headers and 2 prefixed headers. Each header can be up to 256 characters.

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.data.tables.UpdateMode[source]

An enumeration.

MERGE = 'merge'
REPLACE = 'replace'
class azure.data.tables.TableItem(table: str, headers: dict[str, str] = None)[source]

Represents an Azure TableItem. Returned by TableServiceClient.list_tables and TableServiceClient.query_tables.

Variables
  • name (str) – The name of the table.

  • api_version (str) – The API version included in the service call

  • date (str) – The date the service call was made

class azure.data.tables.TableEntity[source]

An entity object. Can be accessed as a dict or as an obj. The attributes of the entity will be created dynamically. For example, the following are both valid:

TableEntity = TableEntity()
TableEntity.a = 'b'
TableEntity['x'] = 'y'
clear() → None. Remove all items from D.
copy() → a shallow copy of D
fromkeys()

Returns a new dict with keys from iterable and values equal to value.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D’s items
keys() → a set-like object providing a view on D’s keys
metadata(**kwargs) → Dict[str, Any][source]

Resets metadata to be a part of the entity :return Dict of entity metadata :rtype Dict[str, Any]

pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() → an object providing a view on D’s values
class azure.data.tables.EntityProperty(value=None, type=None)[source]

An entity property. Used to explicitly set EdmType when necessary.

Values which require explicit typing are GUID, INT32, and BINARY. Other EdmTypes may be explicitly create as EntityProperty objects but need not be. For example, the below with both create STRING typed properties on the entity:

entity = Entity()
entity.a = 'b'
entity.x = EntityProperty(EdmType.STRING, 'y')

Represents an Azure Table. Returned by list_tables.

Parameters
  • EdmType] type (Union[str,) – The type of the property.

  • value (Any) – The value of the property.

class azure.data.tables.EdmType[source]

Used by EntityProperty to represent the type of the entity property to be stored by the Table service.

BINARY = 'Edm.Binary'

Represents byte data. This type will be inferred for Python bytes..

BOOLEAN = 'Edm.Boolean'

Represents a boolean. This type will be inferred for Python bools.

DATETIME = 'Edm.DateTime'

Represents a date. This type will be inferred for Python datetime objects.

DOUBLE = 'Edm.Double'

Represents a double. This type will be inferred for Python floating point numbers.

GUID = 'Edm.Guid'

Represents a GUID. This type will be inferred for uuid.UUID.

INT32 = 'Edm.Int32'

Represents a number between -(2^15) and 2^15. Must be specified or numbers will default to INT64.

INT64 = 'Edm.Int64'

Represents a number between -(2^31) and 2^31. This is the default type for Python numbers.

STRING = 'Edm.String'

Represents a string. This type will be inferred for Python strings.

class azure.data.tables.RetentionPolicy(enabled: bool = False, days: int = None, **kwargs: Any)[source]

The retention policy which determines how long the associated data should persist.

All required parameters must be populated in order to send to Azure.

Parameters
  • enabled (bool) – Required. Indicates whether a retention policy is enabled for the storage service.

  • days (int) – Indicates the number of days that metrics or logging or soft-deleted data should be retained. All data older than this value will be deleted.

  • kwargs (Any) –

as_dict(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)

Return a dict that can be JSONify using json.dump.

Advanced usage might optionaly use a callback as parameter:

Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.

The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.

See the three examples in this file:

  • attribute_transformer

  • full_restapi_key_transformer

  • last_restapi_key_transformer

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

key_transformer (function) – A key transformer function.

Returns

A dict JSON compatible object

Return type

dict

classmethod deserialize(data, content_type=None)

Parse a str using the RestAPI syntax and return a model.

Parameters
  • data (str) – A str using RestAPI structure. JSON by default.

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod enable_additional_properties_sending()
classmethod from_dict(data, key_extractors=None, content_type=None)

Parse a dict using given key extractor return a model.

By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)

Parameters
  • data (dict) – A dict using RestAPI structure

  • content_type (str) – JSON by default, set application/xml if XML.

Returns

An instance of this model

Raises

DeserializationError if something went wrong

classmethod is_xml_model()
serialize(keep_readonly=False, **kwargs)

Return the JSON that would be sent to azure from this model.

This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).

If you want XML serialization, you can pass the kwargs is_xml=True.

Parameters

keep_readonly (bool) – If you want to serialize the readonly attributes

Returns

A dict JSON compatible object

Return type

dict

validate()

Validate this model recursively and return a list of ValidationError.

Returns

A list of validation error

Return type

list

class azure.data.tables.SASProtocol[source]

An enumeration.

HTTP = 'http'
HTTPS = 'https'
azure.data.tables.generate_account_sas(account_name: str, account_key: str, resource_types: ResourceTypes, permission: Union[str, AccountSasPermissions], expiry: Union[datetime, str], **kwargs: Any)str[source]

Generates a shared access signature for the table service. Use the returned signature with the sas_token parameter of TableService.

Parameters

account_name – Account name

:type account_name:str :param account_key: Account key :type account_key:str :param resource_types:

Specifies the resource types that are accessible with the account SAS.

Parameters
  • permission (Union[str, AccountSasPermissions]) – The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy.

  • expiry (Union[datetime,str]) – The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

Keyword Arguments
  • start (Union[datetime,str]) – The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

  • ip_address_or_range (str) – Specifies an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses.

  • SASProtocol] protocol (Union[str,) – Specifies the protocol permitted for a request made.

Returns

A Shared Access Signature (sas) token.

Return type

str

azure.data.tables.generate_table_sas(account_name: str, account_key: str, table_name: str, **kwargs: Any)str[source]

Generates a shared access signature for the table service. Use the returned signature with the sas_token parameter of TableService.

Parameters
  • account_key (str) – Account key

  • account_name (str) – Account name

  • table_name (str) – Table name

Keyword Arguments
  • permission (TableSasPermissions) – The permissions associated with the shared access signature. The user is restricted to operations allowed by the permissions. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy.

  • expiry (Union[datetime,str]) – The time at which the shared access signature becomes invalid. Required unless an id is given referencing a stored access policy which contains this field. This field must be omitted if it has been specified in an associated stored access policy. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

  • start (Union[datetime,str]) – The time at which the shared access signature becomes valid. If omitted, start time for this call is assumed to be the time when the storage service receives the request. Azure will always convert values to UTC. If a date is passed in without timezone info, it is assumed to be UTC.

  • ip_address_or_range (str) – Specifies an IP address or a range of IP addresses from which to accept requests. If the IP address from which the request originates does not match the IP address or address range specified on the SAS token, the request is not authenticated. For example, specifying sip=168.1.5.65 or sip=168.1.5.60-168.1.5.70 on the SAS restricts the request to those IP addresses.

  • policy_id (str) – Access policy ID.

  • SASProtocol] protocol (Union[str,) – Specifies the protocol permitted for a request made.

  • end_rk (str) – End row key

  • end_pk (str) – End partition key

  • start_rk (str) – Starting row key

  • start_pk (str) – Starting partition key

Returns

A Shared Access Signature (sas) token.

Return type

str