Skip to content

Commit 49ed561

Browse files
Lorenzo ManganiLorenzo Mangani
Lorenzo Mangani
authored and
Lorenzo Mangani
committed
resync
1 parent 75bd5f5 commit 49ed561

File tree

6 files changed

+76
-96
lines changed

6 files changed

+76
-96
lines changed

.github/workflows/MainDistributionPipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
with:
1919
duckdb_version: main
2020
ci_tools_version: main
21-
extension_name: quack
21+
extension_name: redis
2222

2323
duckdb-stable-build:
2424
name: Build extension binaries
2525
uses: duckdb/extension-ci-tools/.github/workflows/[email protected]
2626
with:
2727
duckdb_version: v1.2.1
2828
ci_tools_version: v1.2.1
29-
extension_name: quack
29+
extension_name: redis

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PROJ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
22

33
# Configuration of extension
4-
EXT_NAME=quack
4+
EXT_NAME=redis
55
EXT_CONFIG=${PROJ_DIR}extension_config.cmake
66

77
# Include the Makefile from extension-ci-tools

docs/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,75 @@
1+
# DuckDB Redis Extension
2+
This extension provides Redis client functionality for DuckDB, allowing you to interact with a Redis server directly from SQL queries. The extension uses Boost.Asio for network communication and implements basic Redis protocol commands.
3+
4+
## Features
5+
Currently supported Redis operations:
6+
- `redis_get(key, host, port)`: Retrieves a value from Redis for a given key
7+
- `redis_set(key, value, host, port)`: Sets a value in Redis for a given key
8+
9+
## Installation
10+
```sql
11+
INSTALL 'redis' FROM community;
12+
LOAD 'redis';
13+
```
14+
15+
## Usage Examples
16+
### Setting Values in Redis
17+
```sql
18+
-- Set a single value
19+
SELECT redis_set('user:1', 'John Doe', 'localhost', '6379') as result;
20+
21+
-- Set multiple values in a query
22+
INSERT INTO users (id, name, age)
23+
SELECT redis_set(
24+
'user:' || id::VARCHAR,
25+
name,
26+
'localhost',
27+
'6379'
28+
)
29+
FROM new_users;
30+
```
31+
32+
### Getting Values from Redis
33+
```sql
34+
-- Get a single value
35+
SELECT redis_get('user:1', 'localhost', '6379') as user_name;
36+
37+
-- Get multiple values
38+
SELECT
39+
id,
40+
redis_get('user:' || id::VARCHAR, 'localhost', '6379') as user_data
41+
FROM user_ids;
42+
```
43+
44+
## Building from Source
45+
Follow the standard DuckDB extension build process:
46+
47+
```sh
48+
# Install vcpkg dependencies
49+
./vcpkg/vcpkg install boost-asio
50+
51+
# Build the extension
52+
make
53+
```
54+
55+
## Dependencies
56+
- Boost.Asio (header-only, installed via vcpkg)
57+
58+
## Error Handling
59+
The extension functions will throw exceptions with descriptive error messages when:
60+
- Unable to connect to Redis server
61+
- Network communication errors occur
62+
- Invalid Redis protocol responses are received
63+
64+
## Future Enhancements
65+
Planned features include:
66+
- Support for Redis authentication
67+
- Connection pooling for better performance
68+
- Additional Redis commands (HGET, HSET, LPUSH, etc.)
69+
- Table functions for scanning Redis keys
70+
- Batch operations using Redis pipelines
71+
- Connection timeout handling
72+
173
# DuckDB Extension Template
274
This repository contains a template for creating a DuckDB extension. The main goal of this template is to allow users to easily develop, test and distribute their own DuckDB extension. The main branch of the template is always based on the latest stable DuckDB allowing you to try out your extension right away.
375

extension_config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is included by DuckDB's build system. It specifies which extension to load
22

33
# Extension from this repo
4-
duckdb_extension_load(quack
4+
duckdb_extension_load(redis
55
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}
66
LOAD_TESTS
77
)

src/include/quack_extension.hpp

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/quack_extension.cpp

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)