Excel Add-In for Redis

Build 24.0.9064

Modeling Redis Hashes as Tables

The add-in can be configured to shape the discovered metadata.

Use the DefineTables, TablePattern, and PatternSeparator connection properties to customize how tables and columns are inferred from the Redis key store.

Presume the following hashes have been created in the Redis server (either with redis-cli or the RunCommand storec procedure).

> hmset user:1000 name "John Smith" email "[email protected]" password "s3cret"
OK
> hmset user:1001 name "Mary Jones" email "[email protected]" password "hidden" 
OK
> hmset user:1002 name "Sally Brown" email "[email protected]" password "p4ssw0rd"
OK
> hmset customer:200 name "John Smith" account "123456" balance "543.21"
OK
> hmset customer:201 name "Mary Jones" account "123457" balance "654.32" 
OK
> hmset customer:202 name "Sally Brown" account "123458" balance "765.43"
OK

When these properties are used to define the add-in's behavior, the Redis keys will be pivoted, so that each Redis key that matches the pattern in the definition is represented as a single row in the table. Each value associated with that Redis key becomes a column for the table.

DefineTables Property

The DefineTables connection property allows you to explicitly define the names of the tables that will appear. To do so, set the property to a comma-separated string of name-value pairs, where the name is the name of the table and the value is the pattern used to assign Redis keys to that table.

The add-in aggregates all of the Redis keys that match the specified patterns.

DefineTables=Users=user:*,Customers=customer:*;

With the property set as above, the Users and Customers tables will be exposed. If you were to query the tables, you would see the following results:

SELECT * FROM Users

RedisKey name email password
user:1000 John Smith [email protected] s3cret
user:1001 Mary Jones [email protected] hidden
user:1002 Sally Brown sally.b@example p4ssw0rd

SELECT * FROM Customers

RedisKey name account balance
customer:200 John Smith 123456 543.21
customer:201 Mary Jones 123456 654.32
customer:202 Sally Brown 123456 765.43

TablePattern Property

The TablePattern connection property allows you to define the separator(s) that determine how the add-in defines tables. For the Redis keys described above, "user" and "customer" would be defined as tables if the separator is set to ":" since the unique piece of each Redis key appears after the ":". If you have a need to structure the tables differently, to drill down further, you can include multiple instances of the separator. Set the property to a pattern that includes the separator(s) needed to define your table structure. (Below is the default value.)

You can also manually specify the pattern separator indepently from the TablePattern using the PatternSeparator property.

TablePattern=*:*;

With the property set as above, the user and customer tables will be exposed. If you were to query the tables, you would see the following results:

SELECT * FROM user

RedisKey name email password
user:1000 John Smith [email protected] s3cret
user:1001 Mary Jones [email protected] hidden
user:1002 Sally Brown sally.b@example p4ssw0rd

SELECT * FROM customer

RedisKey name account balance
customer:200 John Smith 123456 543.21
customer:201 Mary Jones 123456 654.32
customer:202 Sally Brown 123456 765.43

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9064