text: // Copyright (c) Microsoft Corporation.
  // Licensed under the MIT license.
  
  /**
   * This sample demonstrates create and delete entities in a table
   *
   * @summary creates and deletes a entities in a table
   */
  
  const { TableClient, TablesSharedKeyCredential } = require("@azure/data-tables");
  const { v4 } = require("uuid");
  // Load the .env file if it exists
  const dotenv = require("dotenv");
  dotenv.config();
  
  const tablesUrl = process.env["TABLES_URL"] || "";
  const accountName = process.env["ACCOUNT_NAME"] || "";
  const accountKey = process.env["ACCOUNT_KEY"] || "";
  const tableSufix = v4().replace(/-/g, "");
  
  async function createAndDeleteEntities() {
    console.log("== Create and delete entities Sample ==");
  
    // Note that this sample assumes that a table with tableName exists
    const tableName = `createAndDeleteEntitiesTable${tableSufix}`;
  
    // See authenticationMethods sample for other options of creating a new client
    const creds = new TablesSharedKeyCredential(accountName, accountKey);
    const client = new TableClient(tablesUrl, tableName, creds);
  
    // Create the table
    await client.create();
  
    const entity = {
      partitionKey: "Stationery",
      rowKey: "A1",
      name: "Marker Set",
      price: 5.0,
      quantity: 21
    };
  
    // Create the new entity
    await client.createEntity(entity);
  
    // Delete the entity
    await client.deleteEntity(entity.partitionKey, entity.rowKey);
  
    // Delete the table for cleanup
    // Create the table
    await client.delete();
  }
  
  async function main() {
    await createAndDeleteEntities();
  }
  
  main().catch((err) => {
    console.error("The sample encountered an error:", err);
  });
  