azure.data.tables package¶
- exception azure.data.tables.RequestTooLargeError(**kwargs: Any)[source]¶
An error response with status code 413 - Request Entity Too Large
- add_note()¶
Exception.add_note(note) – add a note to the exception
- raise_with_traceback() None¶
Raise the exception with the existing traceback.
Deprecated since version 1.22.0: This method is deprecated as we don’t support Python 2 anymore. Use raise/from instead.
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args¶
- exception azure.data.tables.TableTransactionError(**kwargs: Any)[source]¶
There is a failure in the transaction operations.
- Variables:
index (int) – If available, the index of the operation in the transaction that caused the error. Defaults to 0 in the case where an index was not provided, or the error applies across operations.
error_code (TableErrorCode) – The error code.
message (str) – The error message.
additional_info (Mapping[str, Any]) – Any additional data for the error.
- add_note()¶
Exception.add_note(note) – add a note to the exception
- raise_with_traceback() None¶
Raise the exception with the existing traceback.
Deprecated since version 1.22.0: This method is deprecated as we don’t support Python 2 anymore. Use raise/from instead.
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- args¶
- class azure.data.tables.AccountSasPermissions(**kwargs: Any)[source]¶
AccountSasPermissionsclass to be used with generate_account_sas.- Keyword Arguments:
read (bool) – Valid for all signed resources types (Service, Container, and Object). Permits read permissions to the specified resource type. Default value is False.
write (bool) – Valid for all signed resources types (Service, Container, and Object). Permits write permissions to the specified resource type. Default value is False.
delete (bool) – Valid for Container and Object resource types, except for queue messages. Default value is False.
list (bool) – Valid for Service and Container resource types only. Default value is False.
add (bool) – Valid for the following Object resource types only: queue messages, and append blobs. Default value is False.
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. Default value is False.
update (bool) – Valid for the following Object resource types only: queue messages. Default value is False.
process (bool) – Valid for the following Object resource type only: queue messages. Default value is False.
- classmethod from_string(permission: str, **kwargs: Any) AccountSasPermissions[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.
- Returns:
An AccountSasPermissions object
- Return type:
- class azure.data.tables.EdmType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Represent the type of the entity property to be stored by the Table service.
- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith(suffix[, start[, end]]) bool¶
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- format(*args, **kwargs) str¶
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str¶
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, count=-1, /)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith(prefix[, start[, end]]) bool¶
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- 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 booleans.
- 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. This is the default type for Python numbers.
- INT64 = 'Edm.Int64'¶
Represents a number between -(2^31) and 2^31. Must be specified or numbers will default to INT32.
- STRING = 'Edm.String'¶
Represents a string. This type will be inferred for Python strings.
- class azure.data.tables.EntityMetadata[source]¶
- clear() None. Remove all items from D.¶
- copy() a shallow copy of D¶
- fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items¶
- keys() a set-like object providing a view on D's keys¶
- pop(k[, d]) v, remove specified key and return the corresponding value.¶
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- 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¶
- editLink: str¶
The link used to edit/update the entry, if the entity is updatable and the odata.id does not represent a URL that can be used to edit the entity. This is not returned by default, and only returned if full metadata is requested.
- etag: str | None¶
A string representation of the timestamp property. Used to provide optimistic concurrency.
- id: str¶
The entity ID, which is generally the URL to the resource. This is not returned by default, and only returned if full metadata is requested.
- class azure.data.tables.EntityProperty(value, edm_type)¶
An entity property. Used to explicitly set
EdmTypewhen necessary.Values which require explicit typing are GUID, INT64, 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 = TableEntity() entity.a = 'b' entity.x = EntityProperty('y', EdmType.STRING)
- Parameters:
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- class azure.data.tables.ResourceTypes(**kwargs: Any)[source]¶
Specifies the resource types that are accessible with the account SAS.
- Keyword Arguments:
service (bool) – Access to service-level APIs (e.g., Get/Set Service Properties, Get Service Stats, List Tables). Default value is False.
object (bool) – Access to object-level APIs for tables (e.g. Get/Create/Query Entity etc.). Default value is False.
container (bool) – Access to container-level APIs for tables (e.g. Create Tables etc.). Default value is False.
- classmethod from_string(string: str) ResourceTypes[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:
- class azure.data.tables.SASProtocol(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith(suffix[, start[, end]]) bool¶
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- format(*args, **kwargs) str¶
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str¶
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, count=-1, /)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith(prefix[, start[, end]]) bool¶
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- HTTP = 'http'¶
- HTTPS = 'https'¶
- class azure.data.tables.TableAccessPolicy(**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).
- Keyword Arguments:
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: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]¶
Return a dict that can be serialized using json.dump.
Advanced usage might optionally 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:
- classmethod deserialize(data: Any, content_type: str | None = None) ModelType¶
Parse a str using the RestAPI syntax and return a model.
- classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType¶
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)
- class azure.data.tables.TableAnalyticsLogging(**kwargs: Any)[source]¶
Azure Analytics Logging settings.
- Keyword Arguments:
version (str) – The version of Storage Analytics to configure. Default value is “1.0”.
delete (bool) – Indicates whether all delete requests should be logged. Default value is False.
read (bool) – Indicates whether all read requests should be logged. Default value is False.
write (bool) – Indicates whether all write requests should be logged. Default value is False.
retention_policy (TableRetentionPolicy) – The retention policy for the metrics. Default value is a TableRetentionPolicy object with default settings.
- as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]¶
Return a dict that can be serialized using json.dump.
Advanced usage might optionally 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:
- classmethod deserialize(data: Any, content_type: str | None = None) ModelType¶
Parse a str using the RestAPI syntax and return a model.
- classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType¶
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)
- serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]¶
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.
- retention_policy: TableRetentionPolicy¶
- class azure.data.tables.TableClient(endpoint: str, table_name: str, *, credential: AzureSasCredential | AzureNamedKeyCredential | TokenCredential | None = None, api_version: str | None = None, **kwargs: Any)[source]¶
A client to interact with a specific Table in an Azure Tables account.
- Variables:
account_name (str) – The name of the Tables account.
table_name (str) – The name of the table.
scheme (str) – The scheme component in the full URL to the Tables account.
url (str) – The full endpoint URL to this entity, including SAS token if used.
api_version (str) – The version of the Storage API used for requests.
credential (AzureNamedKeyCredential or AzureSasCredential or TokenCredential or None) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), AzureSasCredential (azure-core), or a TokenCredential implementation from azure-identity.
Create TableClient from a Credential.
- Parameters:
- Keyword Arguments:
credential (AzureNamedKeyCredential or AzureSasCredential or TokenCredential or None) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), AzureSasCredential (azure-core), or a TokenCredential implementation from azure-identity.
api_version (str or None) – Specifies the version of the operation to use for this request. Default value is “2019-02-02”.
- Returns:
None
- close() None¶
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: TableEntity | Mapping[str, Any], **kwargs) Dict[str, Any][source]¶
Inserts entity in a table.
- Parameters:
entity (Union[TableEntity, Mapping[str, Any]]) – The properties for the table entity.
- Returns:
Dictionary mapping operation metadata returned from the service.
- Return type:
- Raises:
ResourceExistsErrorIf the entity already exists
Example:
Creating and adding an entity to a Table¶try: resp = table_client.create_entity(entity=self.entity) print(resp) except ResourceExistsError: print("Entity already exists")
- create_table(**kwargs) TableItem[source]¶
Creates a new table under the current account.
- Returns:
A TableItem representing the created table.
- Return type:
- Raises:
ResourceExistsErrorIf the entity already exists
Example:
Creating a table from the TableClient object.¶with TableClient.from_connection_string( conn_str=self.connection_string, table_name=self.table_name ) as table_client: try: table_item = table_client.create_table() print(f"Created table {table_item.name}!") except ResourceExistsError: print("Table already exists")
- delete_entity(partition_key: str, row_key: str, *, etag: str | None = None, match_condition: MatchConditions | None = None, **kwargs: Any) None[source]¶
- delete_entity(entity: EntityType, *, etag: str | None = None, match_condition: MatchConditions | None = None, **kwargs: Any) None
- delete_table(**kwargs) None[source]¶
Deletes the table under the current account. No error will be raised if the table does not exist.
- Returns:
None
- Raises:
Example:
Deleting a table from the TableClient object.¶with TableClient.from_connection_string( conn_str=self.connection_string, table_name=self.table_name ) as table_client: table_client.delete_table() print(f"Deleted table {table_client.table_name}!")
- classmethod from_connection_string(conn_str: str, table_name: str, **kwargs: Any) TableClient[source]¶
Create TableClient from a Connection String.
- Parameters:
- Returns:
A table client.
- Return type:
Example:
Authenticating a TableServiceClient from a connection_string¶from azure.data.tables import TableClient with TableClient.from_connection_string( conn_str=self.connection_string, table_name="tableName" ) as table_client: print(f"Table name: {table_client.table_name}")
- classmethod from_table_url(table_url: str, *, credential: AzureNamedKeyCredential | AzureSasCredential | None = None, **kwargs: Any) 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.
- Keyword Arguments:
credential (AzureNamedKeyCredential or AzureSasCredential or None) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), AzureSasCredential (azure-core), or a TokenCredential implementation from azure-identity.
- Returns:
A table client.
- Return type:
- get_entity(partition_key: str, row_key: str, *, select: str | List[str] | None = None, **kwargs) TableEntity[source]¶
Gets a single entity in a table.
- Parameters:
- Keyword Arguments:
select (str or list[str] or None) – Specify desired properties of an entity to return.
- Returns:
Dictionary mapping operation metadata returned from the service.
- Return type:
- Raises:
Example:
Getting an entity with PartitionKey and RowKey from a table¶# Get Entity by partition and row key got_entity = table.get_entity(partition_key=my_entity["PartitionKey"], row_key=my_entity["RowKey"]) print(f"Received entity: {got_entity}")
- get_table_access_policy(**kwargs) Dict[str, TableAccessPolicy | None][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, TableAccessPolicy] or dict[str, None]
- Raises:
- list_entities(*, results_per_page: int | None = None, select: str | List[str] | None = None, **kwargs) ItemPaged[TableEntity][source]¶
Lists entities in a table.
- Keyword Arguments:
- Returns:
An iterator of
TableEntity- Return type:
- Raises:
Example:
Listing all entities held within a table¶# Query the entities in the table entities = list(table.list_entities()) for i, entity in enumerate(entities): print(f"Entity #{entity}: {i}")
- query_entities(query_filter: str, *, results_per_page: int | None = None, select: str | List[str] | None = None, parameters: Dict[str, Any] | None = None, **kwargs) ItemPaged[TableEntity][source]¶
Queries entities in a table.
- Parameters:
query_filter (str) – Specify a filter to return certain entities. For more information on filter formatting, see the samples documentation.
- Keyword Arguments:
- Returns:
An iterator of
TableEntity- Return type:
- Raises:
Example:
Querying entities held within a table¶with TableClient.from_connection_string(self.connection_string, self.table_name) as table_client: try: print("Basic sample:") print("Entities with name: marker") parameters: Dict[str, Any] = {"name": "marker"} name_filter = "Name eq @name" queried_entities = table_client.query_entities( query_filter=name_filter, select=["Brand", "Color"], parameters=parameters ) for entity_chosen in queried_entities: print(entity_chosen) print("Sample for querying entities with multiple params:") print("Entities with name: marker and brand: Crayola") parameters = {"name": "marker", "brand": "Crayola"} name_filter = "Name eq @name and Brand eq @brand" queried_entities = table_client.query_entities( query_filter=name_filter, select=["Brand", "Color"], parameters=parameters ) for entity_chosen in queried_entities: print(entity_chosen) print("Sample for querying entities' values:") print("Entities with 25 < Value < 50") parameters = {"lower": 25, "upper": 50} name_filter = "Value gt @lower and Value lt @upper" queried_entities = table_client.query_entities( query_filter=name_filter, select=["Value"], parameters=parameters ) for entity_chosen in queried_entities: print(entity_chosen) except HttpResponseError as e: raise
- set_table_access_policy(signed_identifiers: Mapping[str, TableAccessPolicy | None], **kwargs) None[source]¶
Sets stored access policies for the table that may be used with Shared Access Signatures.
- Parameters:
signed_identifiers (Mapping[str, Optional[TableAccessPolicy]]) – Access policies to set for the table.
- Returns:
None
- Raises:
- submit_transaction(operations: Iterable[Tuple[TransactionOperation | str, TableEntity | Mapping[str, Any]] | Tuple[TransactionOperation | str, TableEntity | Mapping[str, Any], Mapping[str, Any]]], **kwargs) List[Mapping[str, Any]][source]¶
Commits a list of operations as a single transaction.
If any one of these operations fails, the entire transaction will be rejected.
- Parameters:
operations (Iterable[Tuple[str, TableEntity, Mapping[str, Any]]]) –
The list of operations to commit in a transaction. This should be an iterable of tuples containing an operation name, the entity on which to operate, and optionally, a dict of additional kwargs for that operation. For example:
- ('upsert', {'PartitionKey': 'A', 'RowKey': 'B'}) - ('upsert', {'PartitionKey': 'A', 'RowKey': 'B'}, {'mode': UpdateMode.REPLACE})
- Returns:
A list of mappings with response metadata for each operation in the transaction.
- Return type:
- Raises:
Example:
Using transactions to send multiple requests at once¶from azure.data.tables import TableClient, TableTransactionError from azure.core.exceptions import ResourceExistsError entity1 = {"PartitionKey": "pk001", "RowKey": "rk001", "Value": 4, "day": "Monday", "float": 4.003} entity2 = {"PartitionKey": "pk001", "RowKey": "rk002", "Value": 4, "day": "Tuesday", "float": 4.003} entity3 = {"PartitionKey": "pk001", "RowKey": "rk003", "Value": 4, "day": "Wednesday", "float": 4.003} entity4 = {"PartitionKey": "pk001", "RowKey": "rk004", "Value": 4, "day": "Thursday", "float": 4.003} # Instantiate a TableClient using a connection string with TableClient.from_connection_string( conn_str=self.connection_string, table_name=self.table_name ) as table_client: try: table_client.create_table() print("Created table") except ResourceExistsError: print("Table already exists") table_client.upsert_entity(entity2) table_client.upsert_entity(entity3) table_client.upsert_entity(entity4) operations: List[TransactionOperationType] = [ ("create", entity1), ("delete", entity2), ("upsert", entity3), ("update", entity4, {"mode": "replace"}), ] try: table_client.submit_transaction(operations) except TableTransactionError as e: print("There was an error with the transaction operation") print(f"Error: {e}")
- update_entity(entity: TableEntity | Mapping[str, Any], mode: UpdateMode = UpdateMode.MERGE, *, etag: str | None = None, match_condition: MatchConditions | None = None, **kwargs) Dict[str, Any][source]¶
Updates an entity in a table.
- Parameters:
entity (TableEntity or dict[str, Any]) – The properties for the table entity.
mode (UpdateMode) – Merge or Replace entity.
- Keyword Arguments:
etag (str or None) – Etag of the entity.
match_condition (MatchConditions or None) – The condition under which to perform the operation. Supported values include: MatchConditions.IfNotModified, MatchConditions.Unconditionally.
- Returns:
Dictionary mapping operation metadata returned from the service.
- Return type:
- Raises:
Example:
Updating an already existing 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=str(created["PartitionKey"]), row_key=str(created["RowKey"])) print(f"Replaced entity: {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=str(replaced["PartitionKey"]), row_key=str(replaced["RowKey"])) print(f"Merged entity: {merged}")
- upsert_entity(entity: TableEntity | Mapping[str, Any], mode: UpdateMode = UpdateMode.MERGE, **kwargs) Dict[str, Any][source]¶
Updates (merge or replace) an entity into a table.
- Parameters:
entity (TableEntity or dict[str, Any]) – The properties for the table entity.
mode (UpdateMode) – Merge or Replace entity.
- Returns:
Dictionary mapping operation metadata returned from the service.
- Return type:
- Raises:
Example:
Replacing/Merging or Inserting an entity into a table¶# Try Replace and insert on fail insert_entity = table.upsert_entity(mode=UpdateMode.REPLACE, entity=entity1) print(f"Inserted entity: {insert_entity}") created["text"] = "NewMarker" merged_entity = table.upsert_entity(mode=UpdateMode.MERGE, entity=entity) print(f"Merged entity: {merged_entity}")
- class azure.data.tables.TableCorsRule(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.
- 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. Default value is 0.
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.
- class azure.data.tables.TableEntity[source]¶
An Entity dictionary with additional metadata
- clear() None. Remove all items from D.¶
- copy() a shallow copy of D¶
- fromkeys(value=None, /)¶
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)¶
Return the value for key if key is in the dictionary, else default.
- items() a set-like object providing a view on D's items¶
- keys() a set-like object providing a view on D's keys¶
- pop(k[, d]) v, remove specified key and return the corresponding value.¶
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()¶
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)¶
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- 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¶
- property metadata: EntityMetadata¶
Includes the metadata with etag and timestamp.
- Returns:
Dict of entity metadata
- Return type:
- class azure.data.tables.TableErrorCode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith(suffix[, start[, end]]) bool¶
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- format(*args, **kwargs) str¶
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str¶
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, count=-1, /)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith(prefix[, start[, end]]) bool¶
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- 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'¶
- NOT_IMPLEMENTED = 'NotImplemented'¶
- NO_AUTHENTICATION_INFORMATION = 'NoAuthenticationInformation'¶
- 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.TableItem(name: str)[source]¶
Represents an Azure TableItem. Returned by TableServiceClient.list_tables and TableServiceClient.query_tables.
- Parameters:
name (str) – Name of the Table
- class azure.data.tables.TableMetrics(**kwargs: Any)[source]¶
A summary of request statistics grouped by API in hour or minute aggregates.
- Keyword Arguments:
version (str) – The version of Storage Analytics to configure. Default value is “1.0”.
enabled (bool) – Indicates whether metrics are enabled for the service. Default value is False.
include_apis (bool) – Indicates whether metrics should generate summary statistics for called API operations.
retention_policy (TableRetentionPolicy) – The retention policy for the metrics. Default value is a TableRetentionPolicy object with default settings.
- as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]¶
Return a dict that can be serialized using json.dump.
Advanced usage might optionally 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:
- classmethod deserialize(data: Any, content_type: str | None = None) ModelType¶
Parse a str using the RestAPI syntax and return a model.
- classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType¶
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)
- serialize(keep_readonly: bool = False, **kwargs: Any) MutableMapping[str, Any]¶
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.
- retention_policy: TableRetentionPolicy¶
- class azure.data.tables.TableRetentionPolicy(**kwargs: Any)[source]¶
The retention policy which determines how long the associated data should persist.
- Keyword Arguments:
enabled (bool) – Indicates whether a retention policy is enabled for the storage service. Default value is False.
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. Must be specified if policy is enabled.
- as_dict(keep_readonly: bool = True, key_transformer: ~typing.Callable[[str, ~typing.Dict[str, ~typing.Any], ~typing.Any], ~typing.Any] = <function attribute_transformer>, **kwargs: ~typing.Any) MutableMapping[str, Any]¶
Return a dict that can be serialized using json.dump.
Advanced usage might optionally 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:
- classmethod deserialize(data: Any, content_type: str | None = None) ModelType¶
Parse a str using the RestAPI syntax and return a model.
- classmethod from_dict(data: Any, key_extractors: Callable[[str, Dict[str, Any], Any], Any] | None = None, content_type: str | None = None) ModelType¶
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)
- class azure.data.tables.TableSasPermissions(**kwargs: Any)[source]¶
TableSasPermissions class to be used with the
generate_account_sas()function.- Keyword Arguments:
- classmethod from_string(permission: str, **kwargs: Any) TableSasPermissions[source]¶
Create TableSasPermissions 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.
- Returns:
An TableSasPermissions object
- Return type:
- class azure.data.tables.TableServiceClient(endpoint: str, *, credential: AzureSasCredential | AzureNamedKeyCredential | TokenCredential | None = None, api_version: str | None = None, **kwargs: Any)[source]¶
A client to interact with the Table Service at the account level.
This client provides operations to retrieve and configure the account properties as well as list, create and delete tables within the account. For operations relating to a specific table, a client for this entity can be retrieved using the
get_table_client()function.- Variables:
- Parameters:
endpoint (str) – The URL to the table service endpoint. Any other entities included in the URL path (e.g. table) will be discarded. This URL can be optionally authenticated with a SAS token.
- Keyword Arguments:
credential (AzureNamedKeyCredential or AzureSasCredential or TokenCredential or None) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), AzureSasCredential (azure-core), or a TokenCredential implementation from azure-identity.
api_version (str) – The Storage API version to use for requests. Default value is ‘2019-02-02’. Setting to an older version may result in reduced feature compatibility.
Example:
Authenticating a TableServiceClient from a Shared Access Key¶from datetime import datetime, timedelta from azure.data.tables import TableServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential credential = AzureNamedKeyCredential(self.account_name, self.access_key) # Create a SAS token to use for authentication of a client sas_token = generate_account_sas( credential, resource_types=ResourceTypes(service=True), permission=AccountSasPermissions(read=True), expiry=datetime.utcnow() + timedelta(hours=1), ) with TableServiceClient( endpoint=self.endpoint, credential=AzureSasCredential(sas_token) ) as table_service_client: properties = table_service_client.get_service_properties() print(f"{properties}")
Authenticating a TableServiceClient from a Shared Account Key¶from azure.data.tables import TableServiceClient from azure.core.credentials import AzureNamedKeyCredential credential = AzureNamedKeyCredential(self.account_name, self.access_key) with TableServiceClient(endpoint=self.endpoint, credential=credential) as table_service_client: properties = table_service_client.get_service_properties() print(f"{properties}")
- Parameters:
endpoint (str) – A URL to an Azure Tables account.
- Keyword Arguments:
credential (AzureNamedKeyCredential or AzureSasCredential or TokenCredential or None) – The credentials with which to authenticate. This is optional if the account URL already has a SAS token. The value can be one of AzureNamedKeyCredential (azure-core), AzureSasCredential (azure-core), or a TokenCredential implementation from azure-identity.
api_version (str or None) – Specifies the version of the operation to use for this request. Default value is “2019-02-02”.
- close() None¶
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) TableClient[source]¶
Creates a new table under the current account.
- Parameters:
table_name (str) – The Table name.
- Returns:
TableClient
- Return type:
- Raises:
Example:
Creating a table from the TableServiceClient object¶with TableServiceClient.from_connection_string(self.connection_string) as table_service_client: try: table_client = table_service_client.create_table(table_name=self.table_name) print(f"Created table {table_client.table_name}!") except ResourceExistsError: print("Table already exists")
- create_table_if_not_exists(table_name: str, **kwargs) 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:
- Raises:
Example:
Creating a table if it doesn’t exist, from the TableServiceClient object¶with TableServiceClient.from_connection_string(self.connection_string) as table_service_client: table_client = table_service_client.create_table_if_not_exists(table_name=self.table_name) print(f"Table name: {table_client.table_name}")
- delete_table(table_name: str, **kwargs) None[source]¶
Deletes the table under the current account. No error will be raised if the given table is not found.
- Parameters:
table_name (str) – The Table name.
- Returns:
None
- Raises:
Example:
Deleting a table from the TableServiceClient object¶with TableServiceClient.from_connection_string(self.connection_string) as table_service_client: table_service_client.delete_table(table_name=self.table_name) print(f"Deleted table {self.table_name}!")
- classmethod from_connection_string(conn_str: str, **kwargs: Any) 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:
Example:
Authenticating a TableServiceClient from a connection_string¶from azure.data.tables import TableServiceClient with TableServiceClient.from_connection_string(conn_str=self.connection_string) as table_service_client: properties = table_service_client.get_service_properties() print(f"{properties}")
- get_service_properties(**kwargs) Dict[str, object][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
- Return type:
- Raises:
- 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.
- get_table_client(table_name: str, **kwargs: 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
TableClientobject.- Return type:
- list_tables(*, results_per_page: int | None = None, **kwargs) ItemPaged[TableItem][source]¶
Queries tables under the given account.
- Keyword Arguments:
results_per_page (int) – Number of tables per page in returned ItemPaged
- Returns:
An iterator of
TableItem- Return type:
- Raises:
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(f"\t{table.name}")
- query_tables(query_filter: str, *, results_per_page: int | None = None, parameters: Dict[str, Any] | None = None, **kwargs) ItemPaged[TableItem][source]¶
Queries tables under the given account.
- Parameters:
query_filter (str) – Specify a filter to return certain tables.
- Keyword Arguments:
- Returns:
An iterator of
TableItem- Return type:
- Raises:
Example:
Querying tables in a storage account¶table_name = "mytable1" name_filter = f"TableName eq '{table_name}'" queried_tables = table_service.query_tables(name_filter) print("Queried_tables") for table in queried_tables: print(f"\t{table.name}")
- set_service_properties(*, analytics_logging: TableAnalyticsLogging | None = None, hour_metrics: TableMetrics | None = None, minute_metrics: TableMetrics | None = None, cors: List[TableCorsRule] | None = None, **kwargs) None[source]¶
- Sets properties for an account’s Table service endpoint,
including properties for Analytics and CORS (Cross-Origin Resource Sharing) rules.
- Keyword Arguments:
analytics_logging (TableAnalyticsLogging) – Properties for analytics
hour_metrics (TableMetrics) – Hour level metrics
minute_metrics (TableMetrics) – Minute level metrics
cors (list[TableCorsRule]) – Cross-origin resource sharing rules
- Returns:
None
- Raises:
- class azure.data.tables.TransactionOperation(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith(suffix[, start[, end]]) bool¶
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- format(*args, **kwargs) str¶
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str¶
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, count=-1, /)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith(prefix[, start[, end]]) bool¶
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- CREATE = 'create'¶
- DELETE = 'delete'¶
- UPDATE = 'update'¶
- UPSERT = 'upsert'¶
- class azure.data.tables.UpdateMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- endswith(suffix[, start[, end]]) bool¶
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- format(*args, **kwargs) str¶
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str¶
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- index(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- replace(old, new, count=-1, /)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- rfind(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- startswith(prefix[, start[, end]]) bool¶
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- MERGE = 'merge'¶
- REPLACE = 'replace'¶
- azure.data.tables.generate_account_sas(credential: AzureNamedKeyCredential, resource_types: ResourceTypes, permission: str | AccountSasPermissions, expiry: datetime | str, *, start: datetime | str | None = None, ip_address_or_range: str | None = None, protocol: str | SASProtocol | None = None) str[source]¶
Generates a shared access signature for the table service. Use the returned signature with the sas_token parameter of TableService.
- Parameters:
credential (AzureNamedKeyCredential) – Credential for the Azure account
resource_types (ResourceTypes) – Specifies the resource types that are accessible with the account SAS.
permission (str or 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 (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.
- Keyword Arguments:
start (datetime or str or None) – 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 or None) – 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.
protocol (str or SASProtocol or None) – Specifies the protocol permitted for a request made.
- Returns:
A Shared Access Signature (sas) token.
- Return type:
- azure.data.tables.generate_table_sas(credential: AzureNamedKeyCredential, table_name: str, *, permission: TableSasPermissions | str | None = None, expiry: datetime | str | None = None, start: datetime | str | None = None, ip_address_or_range: str | None = None, policy_id: str | None = None, protocol: str | SASProtocol | None = None, start_pk: str | None = None, start_rk: str | None = None, end_pk: str | None = None, end_rk: str | None = None) str[source]¶
Generates a shared access signature for the table service. Use the returned signature with the sas_token parameter of TableService.
- Parameters:
credential (AzureNamedKeyCredential) – Credential used for creating Shared Access Signature
table_name (str) – Table name
- Keyword Arguments:
permission (TableSasPermissions or str or None) – 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 or None) – 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 or None) – 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 or None) – 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 or None) – Access policy ID.
protocol (str or SASProtocol or None) – Specifies the protocol permitted for a request made.
start_rk (str or None) – Starting row key.
start_pk (str or None) – Starting partition key.
end_rk (str or None) – End row key.
end_pk (str or None) – End partition key.
- Returns:
A Shared Access Signature (sas) token.
- Return type:
Subpackages¶
- azure.data.tables.aio package
TableClientTableClient.close()TableClient.create_entity()TableClient.create_table()TableClient.delete_entity()TableClient.delete_table()TableClient.from_connection_string()TableClient.from_table_url()TableClient.get_entity()TableClient.get_table_access_policy()TableClient.list_entities()TableClient.query_entities()TableClient.set_table_access_policy()TableClient.submit_transaction()TableClient.update_entity()TableClient.upsert_entity()TableClient.api_versionTableClient.url
TableServiceClientTableServiceClient.close()TableServiceClient.create_table()TableServiceClient.create_table_if_not_exists()TableServiceClient.delete_table()TableServiceClient.from_connection_string()TableServiceClient.get_service_properties()TableServiceClient.get_service_stats()TableServiceClient.get_table_client()TableServiceClient.list_tables()TableServiceClient.query_tables()TableServiceClient.set_service_properties()TableServiceClient.api_versionTableServiceClient.url