Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme samples #13486

Merged
merged 34 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4c15e4e
updated each sample to use env variables, more informative print stat…
seankane-msft Aug 19, 2020
998a1e4
updating readme with more accurate links, still missing a few
seankane-msft Aug 21, 2020
6e986a9
grammar fixes
seankane-msft Aug 21, 2020
ca60662
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
seankane-msft Aug 24, 2020
75c7982
added a readme, and async versions for auth and create/delete operations
seankane-msft Aug 24, 2020
7a628ea
added more files (copies for async), and a README to the samples portion
seankane-msft Aug 24, 2020
c07cb87
basic commit, merging others into one branch
seankane-msft Aug 24, 2020
b8a7d0a
Merge pull request #1 from seankane-msft/update-samples
seankane-msft Aug 24, 2020
4083729
Merge pull request #2 from seankane-msft/update-readme
seankane-msft Aug 24, 2020
ac9ae75
put async into another folder
seankane-msft Aug 24, 2020
f21354b
more README updates to align with .NET
seankane-msft Sep 1, 2020
9152981
initial draft of README and samples
seankane-msft Sep 1, 2020
8b16b84
initial comments from cala and kate
seankane-msft Sep 2, 2020
eccb1e9
merge conflict on readme
seankane-msft Sep 2, 2020
d3ee484
merge conflict #2
seankane-msft Sep 2, 2020
50e9b78
caught a text analytics reference, thanks kate
seankane-msft Sep 2, 2020
5c9de9c
caught a text analytics reference, thanks kate
seankane-msft Sep 2, 2020
3cb30d2
reverting version
seankane-msft Sep 2, 2020
3dd5e43
fixing two broken links
seankane-msft Sep 2, 2020
432282f
recording for test_list_tables that got left out
seankane-msft Sep 2, 2020
1dfcff9
fixing broken links
seankane-msft Sep 2, 2020
2e96610
another attempt at broken links
seankane-msft Sep 2, 2020
f6961a2
changing parentheses to a bracket per kristas recommendation
seankane-msft Sep 3, 2020
3626f6c
commenting out one test with weird behavior
seankane-msft Sep 3, 2020
01e1ab4
re-run recordings for conflicts
seankane-msft Sep 3, 2020
4f4b468
found an actual broken link
seankane-msft Sep 3, 2020
b6e0b4e
lint fixes
seankane-msft Sep 3, 2020
37c8b6a
update to readme and samples per cala, issy, and kates recs. added ex…
seankane-msft Sep 3, 2020
2613312
added a quote around odata filter, thanks Chris for the catch
seankane-msft Sep 3, 2020
e6bd86b
updating a few more broken links
seankane-msft Sep 3, 2020
a3be3a6
adding an aka.ms link for pypi
seankane-msft Sep 3, 2020
35a1615
two more broken links
seankane-msft Sep 3, 2020
fe8e23b
reverting a change back
seankane-msft Sep 3, 2020
fa1fb92
fixing missing END statements, removing link to nowhere, correcting l…
seankane-msft Sep 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 149 additions & 87 deletions sdk/tables/azure-data-tables/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/tables/azure-data-tables/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
2 changes: 1 addition & 1 deletion sdk/tables/azure-data-tables/azure/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: str
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
81 changes: 81 additions & 0 deletions sdk/tables/azure-data-tables/azure/data/tables/_table_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ def from_connection_string(
:type table_name: str
:returns: A table client.
:rtype: ~azure.data.tables.TableClient

.. admonition:: Example:

.. literalinclude:: ../samples/sample_create_client.py
:start-after: [START create_table_client]
:end-before: [END create_table_client]
:language: python
:dedent: 8
:caption: Authenticating a TableServiceClient from a connection_string
"""
account_url, credential = parse_connection_str(
conn_str=conn_str, credential=None, service='table', keyword_args=kwargs)
Expand Down Expand Up @@ -189,6 +198,15 @@ def create_table(
:return: Dictionary of operation metadata returned from service
:rtype: dict[str,str]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_create_delete_table.py
:start-after: [START create_table_from_table_client]
:end-before: [END create_table_from_table_client]
:language: python
:dedent: 8
:caption: Creating a table from the TableClient object
"""
table_properties = TableProperties(table_name=self.table_name, **kwargs)
try:
Expand All @@ -209,6 +227,15 @@ def delete_table(

:return: None
:rtype: None

.. admonition:: Example:

.. literalinclude:: ../samples/sample_create_delete_table.py
:start-after: [START delete_table_from_table_client]
:end-before: [END delete_table_from_table_client]
:language: python
:dedent: 8
:caption: Deleting a table from the TableClient object
"""
try:
self._client.table.delete(table=self.table_name, **kwargs)
Expand All @@ -234,6 +261,15 @@ def delete_entity(
:return: None
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_insert_delete_entities.py
:start-after: [START delete_entity]
:end-before: [END delete_entity]
:language: python
:dedent: 8
:caption: Deleting an entity to a Table
"""

if_match, _ = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None),
Expand Down Expand Up @@ -264,6 +300,15 @@ def create_entity(
:return: Dictionary mapping operation metadata returned from the service
:rtype: dict[str,str]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_insert_delete_entities.py
:start-after: [START create_entity]
:end-before: [END create_entity]
:language: python
:dedent: 8
:caption: Creating and adding an entity to a Table
"""

if "PartitionKey" in entity and "RowKey" in entity:
Expand Down Expand Up @@ -301,6 +346,15 @@ def update_entity( # pylint:disable=R1710
:return: Dictionary mapping operation metadata returned from the service
:rtype: dict[str,str]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_update_upsert_merge_entities.py
:start-after: [START update_entity]
:end-before: [END update_entity]
:language: python
:dedent: 8
:caption: Updating an already exiting entity in a Table
"""

if_match, _ = _get_match_headers(kwargs=dict(kwargs, etag=kwargs.pop('etag', None),
Expand Down Expand Up @@ -349,6 +403,15 @@ def list_entities(
:return: Query of table entities
:rtype: ItemPaged[TableEntity]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_update_upsert_merge_entities.py
:start-after: [START query_entities]
:end-before: [END query_entities]
:language: python
:dedent: 8
:caption: List all entities held within a table
"""
user_select = kwargs.pop('select', None)
if user_select and not isinstance(user_select, str):
Expand Down Expand Up @@ -380,6 +443,15 @@ def query_entities(
:return: Query of table entities
:rtype: ItemPaged[TableEntity]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_query_table.py
:start-after: [START query_entities]
:end-before: [END query_entities]
:language: python
:dedent: 8
:caption: Query entities held within a table
"""
parameters = kwargs.pop('parameters', None)
filter = self._parameter_filter_substitution(parameters, filter) # pylint: disable = W0622
Expand Down Expand Up @@ -446,6 +518,15 @@ def upsert_entity( # pylint:disable=R1710
:return: Dictionary mapping operation metadata returned from the service
:rtype: dict[str,str]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_update_upsert_merge_entities.py
:start-after: [START upsert_entity]
:end-before: [END upsert_entity]
:language: python
:dedent: 8
:caption: Update/merge or insert an entity into a table
"""

partition_key = entity['PartitionKey']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ def __init__(
key.
:type credential: str
:returns: None

.. admonition:: Example:

.. literalinclude:: ../samples/sample_authentication.py
:start-after: [START auth_from_sas]
:end-before: [END auth_from_sas]
:language: python
:dedent: 8
:caption: Authenticating a TableServiceClient from a Shared Access Key

.. literalinclude:: ../samples/sample_authentication.py
:start-after: [START auth_from_shared_key]
:end-before: [END auth_from_shared_key]
:language: python
:dedent: 8
:caption: Authenticating a TableServiceClient from a Shared Account Key
"""

super(TableServiceClient, self).__init__(account_url, service='table', credential=credential, **kwargs)
Expand All @@ -59,6 +75,15 @@ def from_connection_string(
:type conn_str: str
:returns: A Table service client.
:rtype: ~azure.data.tables.TableServiceClient

.. admonition:: Example:

.. literalinclude:: ../samples/sample_authentication.py
:start-after: [START auth_from_connection_string]
:end-before: [END auth_from_connection_string]
:language: python
:dedent: 8
:caption: Authenticating a TableServiceClient from a connection_string
"""
account_url, credential = parse_connection_str(
conn_str=conn_str, credential=None, service='table', keyword_args=kwargs)
Expand Down Expand Up @@ -149,6 +174,15 @@ def create_table(
:return: TableClient
:rtype: ~azure.data.tables.TableClient
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_create_delete_table.py
:start-after: [START create_table_from_tc]
:end-before: [END create_table_from_tc]
:language: python
:dedent: 8
:caption: Creating a table from the TableServiceClient object
"""
table = self.get_table_client(table_name=table_name)
table.create_table(**kwargs)
Expand All @@ -170,6 +204,15 @@ def create_table_if_not_exists(
:return: TableClient
:rtype: ~azure.data.tables.TableClient
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_create_delete_table.py
:start-after: [START create_table_if_not_exists]
:end-before: [END create_table_if_not_exists]
:language: python
:dedent: 8
:caption: Deleting a table from the TableServiceClient object
"""
table = self.get_table_client(table_name=table_name)
try:
Expand All @@ -191,6 +234,15 @@ def delete_table(
:type table_name: str
:return: None
:rtype: None

.. admonition:: Example:

.. literalinclude:: ../samples/sample_create_delete_table.py
:start-after: [START delete_table_from_tc]
:end-before: [END delete_table_from_tc]
:language: python
:dedent: 8
:caption: Deleting a table from the TableServiceClient object
"""
table = self.get_table_client(table_name=table_name)
table.delete_table(**kwargs)
Expand All @@ -211,6 +263,15 @@ def query_tables(
:return: A query of tables
:rtype: ItemPaged[TableItem]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_query_tables.py
:start-after: [START tsc_query_tables]
:end-before: [END tsc_query_tables]
:language: python
:dedent: 8
:caption: Querying tables in a storage account
"""
parameters = kwargs.pop('parameters', None)
filter = self._parameter_filter_substitution(parameters, filter) # pylint: disable=W0622
Expand Down Expand Up @@ -241,6 +302,15 @@ def list_tables(
:return: A query of tables
:rtype: ItemPaged[TableItem]
:raises: ~azure.core.exceptions.HttpResponseError

.. admonition:: Example:

.. literalinclude:: ../samples/sample_query_tables.py
:start-after: [START tsc_list_tables]
:end-before: [END tsc_list_tables]
:language: python
:dedent: 8
:caption: Listing all tables in a storage account
"""
user_select = kwargs.pop('select', None)
if user_select and not isinstance(user_select, str):
Expand Down
Loading