Power BI Connector for Redis

Build 24.0.9064

Redis Key のフリーフォームクエリ

The most direct way to work with Redis data with the 本製品 is to use a Redis key as a table name. Below you will find sample data, queries, and results based on Redis data types.

Note: This page contains redis-cli syntax. Use either your own instance of redis-cli or the RunCommand procedure to send queries from the 本製品 to the Redis server for direct execution.

Redis Strings

Create a string in Redis:

> set mykey somevalue
OK
If you perform a SELECT query on mykey the 本製品 will return the following:

SELECT * FROM mykey

RedisKey ValueIndex Value RedisType ValueScore
mykey 1 somevalue String NULL

Redis Lists

Create a list in Redis:

> rpush mylist A B C
(integer) 3
If you perform a SELECT query on mylist the 本製品 will return the following:

SELECT * FROM mylist

RedisKey ValueIndex Value RedisType ValueScore
mylist 1 A List NULL
mylist 2 B List NULL
mylist 3 C List NULL

Deleting Redis Lists

List type records can also be removed using DELETE statements, though they must be performed by specifying the Value column in the WHERE clause:

DELETE FROM Keys WHERE Value = 'myvalue' AND RedisKey = 'mylist'

Note that using ValueIndex in the WHERE clause of the DELETE statement is not supported.

Redis Sets

Create a set in Redis:

> sadd myset 1 2 3
(integer) 3
If you perform a SELECT query on myset the 本製品 will return the following (note that Redis can return the elements of a set in any order):

SELECT * FROM myset

RedisKey ValueIndex Value RedisType ValueScore
myset 1 2 Set NULL
myset 2 1 Set NULL
myset 3 3 Set NULL

Redis Sorted Sets

Create a ZSet (sorted set) in Redis:

> zadd hackers 1940 "Alan Kay" 1957 "Sophie Wilson" 1953 "Richard Stallman" 1949 "Anita Borg"
(integer) 9
If you perform a SELECT query on hackers the 本製品 will return the following:

SELECT * FROM hackers

RedisKey ValueIndex Value RedisType ValueScore
hackers 1 Alan Kay ZSet 1940
hackers 2 Anita Borg ZSet 1949
hackers 3 Richard Stallman ZSet 1953
hackers 4 Sophie Wilson ZSet 1957

Redis Hashes

Create a hash in Redis:

> hmset user:1000 username antirez birthyear 1977 verified 1
OK
If you perform a SELECT query on user:1000 the 本製品 will return the following:

SELECT * FROM user:1000

RedisKey ValueIndex Value RedisType ValueScore
user:1000 username antirez Hash NULL
user:1000 birthyear 1977 Hash NULL
user:1000 verified 1 Hash NULL

Querying Key Patterns as Tables

You can retrieve multiple Redis keys at once by using a pattern (e.g., "user:*") as a table name. For example, start by adding several keys to Redis that match a pattern:

> hmset user:1000 name "John Smith" email "[email protected]" password "s3cret"
OK
> hmset user:1001 name "Mary Jones" password "hidden" email "[email protected]"
OK

If you use user:* as the table name, the 本製品 will retrieve all Redis key-value pairs whose keys match the pattern. You can see the expected results below:

SELECT * FROM [user:*]

RedisKey ValueIndex Value RedisType ValueScore
user:1000 name John Smith Hash NULL
user:1000 email [email protected] Hash NULL
user:1000 password s3cret Hash NULL
user:1001 name Mary Jones Hash NULL
user:1001 email [email protected] Hash NULL
user:1001 password hidden Hash NULL

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