from azure.data.tables import TableEntity # Create a new entity with PartitionKey "test1" entity = TableEntity(partition_key="test1", row_key="row1") entity.customer_name = "John" entity.age = 30 # Print the PartitionKey and RowKey attribute of the entity print(entity.partition_key) print(entity.row_key)
from azure.data.tables import TableEntity # Create a new entity with PartitionKey "2022" and RowKey "test2" entity = TableEntity(partition_key="2022", row_key="test2") entity.customer_name = "Marry" entity.age = 28 # Modify the PartitionKey attribute of the entity entity.partition_key = "2023" # Print the PartitionKey and RowKey attribute of the entity print(entity.partition_key) print(entity.row_key)In this example, we create a new `TableEntity` with `PartitionKey` as "2022" and `RowKey` as "test2". We also set some additional attributes to the entity. Finally, we modify the `PartitionKey` attribute of the entity and print the `PartitionKey` and `RowKey` attributes of the entity. Package library: The package library used in these examples is `azure.data.tables`.