Skip links

Accessing Azure Tables in Lisp

In the previous post, we saw how to use cl-azure to access Azure storage, in particular, BLOBs. Today we will experiment with Tables.

The following operations are currently supported by the library:

– Create a new table

– List all the tables available

– Add rows to a table

– List the contents of a table

– Delete a table

The create-table function lets you create a table in your account. If you want to know what tables are available in the account, you can use the function query-tables.

Create Table
Create Table

There is a very useful application called Storage Explorer that you can use to connect to your account and manage the different entities. Here is a screenshot of the app showing the tables in my account:

Storage Explorer View
Storage Explorer View

Let us add two rows to the newly created table. The function insert-entity does this. Every table must have two mandatory columns called PartitionKey and RowKey. These are used as the primary keys. You can add other columns as needed. For this example, let us define additional columns Name and Age, and accordingly populate two entities in the table.

Adding Rows
Adding Rows

The corresponding view in the StorageExplorer is shown below.

New Rows in Storage Explorer
New Rows in Storage Explorer

The last operation we will try is the delete-table command. This will delete a table and all its contents.

Deleting Table
Deleting Table

If you refresh the StorageExplorer view at this time, you can see that there is no table in the account,

After Table Deletion
After Table Deletion

As noted earlier, the library is far from complete. Hope that the author will revisit it and complete it in the near future.

Leave a comment