def put(
        self,
        key: str,
        val: dict,
        collection: str = None,
    ) -> None:
        """Inserts or replaces a key-value pair in the specified table."""
        try:
            from azure.data.tables import UpdateMode
        except ImportError:
            raise ImportError(IMPORT_ERROR_MSG)

        table_name = (
            DEFAULT_COLLECTION if not collection else sanitize_table_name(collection)
        )
        table_client = self._table_service_client.create_table_if_not_exists(table_name)
        table_client.upsert_entity(
            {
                "PartitionKey": self.partition_key,
                "RowKey": key,
                **serialize(self.service_mode, val),
            },
            UpdateMode.REPLACE,
        )
Inserts or replaces a key-value pair in the specified table.
llama-index-integrations/storage/kvstore/llama-index-storage-kvstore-azure/llama_index/storage/kvstore/azure/base.py