def create_if_not_exists(self):
        from azure.data.tables import TableServiceClient

        # [START create_table_if_not_exists]
        with TableServiceClient.from_connection_string(self.connection_string) as table_service_client:
            table_item = TableServiceClient.create_table_if_not_exists(table_name="myTable")
            print("Table name: {}".format(table_item.table_name))
Пример #2
0
    def test_create_table_if_exists_new_table(self, resource_group, location, storage_account, storage_account_key):
        ts = TableServiceClient(self.account_url(storage_account, "table"), storage_account_key)
        table_name = self._get_table_reference()

        t = ts.create_table_if_not_exists(table_name)

        self.assertIsNotNone(t)
        self.assertEqual(t.table_name, table_name)
        ts.delete_table(table_name)
Пример #3
0
    def test_create_table_if_exists_new_table(self, tables_storage_account_name, tables_primary_storage_account_key):
        account_url = self.account_url(tables_storage_account_name, "table")
        ts = TableServiceClient(credential=tables_primary_storage_account_key, endpoint=account_url)
        table_name = self._get_table_reference()

        t = ts.create_table_if_not_exists(table_name)

        assert t is not None
        assert t.table_name ==  table_name
        ts.delete_table(table_name)