Skip to content

Commit

Permalink
fixing samples (#18310)
Browse files Browse the repository at this point in the history
  • Loading branch information
seankane-msft authored Apr 26, 2021
1 parent ec58f5b commit 97978c4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def clean_up(self):
tsc = TableServiceClient.from_connection_string(self.connection_string)
async with tsc:
async for table in tsc.list_tables():
await tsc.delete_table(table.table_name)
await tsc.delete_table(table.name)

print("Cleaned up")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def tables_in_account(self):
# List all the tables in the service
print("Listing tables:")
async for table in table_service.list_tables():
print("\t{}".format(table.table_name))
print("\t{}".format(table.name))
# [END tsc_list_tables]

# [START tsc_query_tables]
Expand All @@ -62,7 +62,7 @@ async def tables_in_account(self):
name_filter = "TableName eq '{}'".format(table_name)
print("Queried_tables")
async for table in table_service.query_tables(name_filter):
print("\t{}".format(table.table_name))
print("\t{}".format(table.name))
# [END tsc_query_tables]

finally:
Expand All @@ -84,7 +84,7 @@ async def clean_up(self):
tsc = TableServiceClient.from_connection_string(self.connection_string)
async with tsc:
async for table in tsc.list_tables():
await tsc.delete_table(table.table_name)
await tsc.delete_table(table.name)

print("Cleaned up")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async def clean_up(self):

async with tsc:
async for table in tsc.list_tables():
await tsc.delete_table(table.table_name)
await tsc.delete_table(table.name)

print("Cleaned up")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ def delete_table(self):
# [END delete_table_from_tc]

def create_from_table_client(self):
from azure.data.table import TableClient
from azure.data.tables import TableClient

# [START create_table_from_table_client]
with TableClient.from_connection_string(conn_str=self.connection_string, table_name="myTable") as table_client:
try:
table_item = table_client.create_table()
print("Created table {}!".format(table_item.table_name))
print("Created table {}!".format(table_item.name))
except ResourceExistsError:
print("Table already exists")
# [END create_table_from_table_client]
Expand Down
4 changes: 2 additions & 2 deletions sdk/tables/azure-data-tables/samples/sample_query_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def tables_in_account(self):
list_tables = table_service.list_tables()
print("Listing tables:")
for table in list_tables:
print("\t{}".format(table.table_name))
print("\t{}".format(table.name))
# [END tsc_list_tables]

# [START tsc_query_tables]
Expand All @@ -65,7 +65,7 @@ def tables_in_account(self):

print("Queried_tables")
for table in queried_tables:
print("\t{}".format(table.table_name))
print("\t{}".format(table.name))
# [END tsc_query_tables]

finally:
Expand Down

0 comments on commit 97978c4

Please sign in to comment.