I would really, really like to store a URI as the RowKey value in Azure Table storage. According to the documentation, RowKeys can't contain characters commonly found in URIs (/, \, #, ?).
The solution seems simple: Just encode the URI. But that doesn't work. For whatever reason, any values containing the sequence %2f (the encoded value for a forward-slash) can be inserted, but not queried even though '%2f' does not contain any forbidden characters.
Okay, so how about base64 encoding? Nope. It produces the occasional forward-slash character, which is not allowed.
So is there a method of encoding a string (a URI) that can be reliably stored as the RowKey in Azure Table? Preferably, but not necessarily, something human-readable.
The row key is a unique identifier for an entity within a given partition. Together the PartitionKey and RowKey uniquely identify every entity within a table. The row key is a string value that may be up to 1 KiB in size. You must include the RowKey property in every insert, update, and delete operation.
Azure table storage is being deprecated in favor of Azure Cosmos DB. Azure Cosmos DB offers many advantages over Azure table storage, such as: -Azure Cosmos DB is scalable.
The key in an Azure Table Storage table comprises two elements. The partition key that identifies the partition containing the row, and a row key that is unique to each row in the same partition. Items in the same partition are stored in row key order. Rows that share the same partition key will be stored together.
Each entity also has three system properties that specify a partition key, a row key, and a timestamp. Entities with the same partition key can be queried more quickly, and inserted/updated in atomic operations. An entity's row key is its unique identifier within a partition.
Replacing / with _ after using base64 encoding should work. Got this suggestion from Encoding and decoding a string that may have slashes in it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With