{"id":27700322,"url":"https://github.com/quackscience/duckdb-extension-redis","last_synced_at":"2025-04-25T18:58:33.073Z","repository":{"id":288757976,"uuid":"969092879","full_name":"quackscience/duckdb-extension-redis","owner":"quackscience","description":"DuckDB Redis Client community extension","archived":false,"fork":false,"pushed_at":"2025-04-19T16:09:05.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T16:54:16.963Z","etag":null,"topics":["duckdb","duckdb-extension","keyval","redis","redis-client"],"latest_commit_sha":null,"homepage":"https://quacks.cc","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quackscience.png","metadata":{"files":{"readme":"docs/README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-19T11:17:55.000Z","updated_at":"2025-04-19T16:10:04.000Z","dependencies_parsed_at":"2025-04-21T08:15:32.121Z","dependency_job_id":null,"html_url":"https://github.com/quackscience/duckdb-extension-redis","commit_stats":null,"previous_names":["quackmagic/duckdb-extension-redis"],"tags_count":1,"template":false,"template_full_name":"duckdb/extension-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quackscience%2Fduckdb-extension-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quackscience%2Fduckdb-extension-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quackscience%2Fduckdb-extension-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quackscience%2Fduckdb-extension-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quackscience","download_url":"https://codeload.github.com/quackscience/duckdb-extension-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250878752,"owners_count":21501741,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["duckdb","duckdb-extension","keyval","redis","redis-client"],"created_at":"2025-04-25T18:58:32.410Z","updated_at":"2025-04-25T18:58:33.061Z","avatar_url":"https://github.com/quackscience.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/user-attachments/assets/46a5c546-7e9b-42c7-87f4-bc8defe674e0\" width=250 /\u003e\n\n# DuckDB Redis Client Extension\nThis extension provides Redis client functionality for DuckDB, allowing you to interact with a Redis server directly from SQL queries.\n\n\u003e Experimental: USE AT YOUR OWN RISK!\n\n## Features\nCurrently supported Redis operations:\n- String operations: `GET`, `SET`\n- Hash operations: `HGET`, `HSET`\n- List operations: `LPUSH`, `LRANGE`\n- Batch operations: `MGET`, `SCAN`\n\n\n## Installation\n```sql\nINSTALL redis FROM community;\nLOAD redis;\n```\n\n## Usage\n### Setting up Redis Connection\nFirst, create a secret to store your Redis connection details:\n\n```sql\n-- Create a Redis connection secret\nCREATE SECRET IF NOT EXISTS redis (\n        TYPE redis,\n        PROVIDER config,\n        host 'localhost',\n        port '6379',\n        password 'optional_password'\n    );\n\n-- Create a Redis cloud connection secret\nCREATE SECRET IF NOT EXISTS redis (\n        TYPE redis,\n        PROVIDER config,\n        host 'redis-1234.ec2.redns.redis-cloud.com',\n        port '16959',\n        password 'xxxxxx'\n    );\n```\n\n### String Operations\n```sql\n-- Set a value\nSELECT redis_set('user:1', 'John Doe', 'redis') as result;\n\n-- Get a value\nSELECT redis_get('user:1', 'redis') as user_name;\n\n-- Set multiple values in a query\nINSERT INTO users (id, name)\nSELECT id, redis_set(\n    'user:' || id::VARCHAR,\n    name,\n    'my_redis'\n)\nFROM new_users;\n```\n\n### Hash Operations\n```sql\n-- Set hash fields\nSELECT redis_hset('user:1', 'email', 'john@example.com', 'redis');\nSELECT redis_hset('user:1', 'age', '30', 'redis');\n\n-- Get hash field\nSELECT redis_hget('user:1', 'email', 'redis') as email;\n\n-- Store user profile as hash\nWITH profile(id, field, value) AS (\n    VALUES \n        (1, 'name', 'John Doe'),\n        (1, 'email', 'john@example.com'),\n        (1, 'age', '30')\n)\nSELECT redis_hset(\n    'user:' || id::VARCHAR,\n    field,\n    value,\n    'redis'\n)\nFROM profile;\n```\n\n### List Operations\n```sql\n-- Push items to list\nSELECT redis_lpush('mylist', 'first_item', 'redis');\nSELECT redis_lpush('mylist', 'second_item', 'redis');\n\n-- Get range from list (returns comma-separated values)\n-- Get all items (0 to -1 means start to end)\nSELECT redis_lrange('mylist', 0, -1, 'redis') as items;\n\n-- Get first 5 items\nSELECT redis_lrange('mylist', 0, 4, 'redis') as items;\n\n-- Push multiple items\nWITH items(value) AS (\n    VALUES ('item1'), ('item2'), ('item3')\n)\nSELECT redis_lpush('mylist', value, 'redis')\nFROM items;\n```\n\n### Batch Operations\n```sql\n-- Get multiple keys at once\nSELECT redis_mget('key1,key2,key3', 'redis') as values;\n-- Returns comma-separated values for all keys\n\n-- Scan keys matching a pattern\nSELECT redis_scan('0', 'user:*', 10, 'redis') as result;\n-- Returns: \"cursor:key1,key2,key3\" where cursor is the next position for scanning\n-- Use the returned cursor for the next scan until cursor is 0\n\n-- Scan all keys matching a pattern\nWITH RECURSIVE scan(cursor, keys) AS (\n    -- Initial scan\n    SELECT split_part(redis_scan('0', 'user:*', 10, 'redis'), ':', 1),\n           split_part(redis_scan('0', 'user:*', 10, 'redis'), ':', 2)\n    UNION ALL\n    -- Continue scanning until cursor is 0\n    SELECT split_part(redis_scan(cursor, 'user:*', 10, 'redis'), ':', 1),\n           split_part(redis_scan(cursor, 'user:*', 10, 'redis'), ':', 2)\n    FROM scan\n    WHERE cursor != '0'\n)\nSELECT keys FROM scan;\n```\n\n## Error Handling\nThe extension functions will throw exceptions with descriptive error messages when:\n- Redis secret is not found or invalid\n- Unable to connect to Redis server\n- Network communication errors occur\n- Invalid Redis protocol responses are received\n\n## Building from Source\nFollow the standard DuckDB extension build process:\n\n```sh\n# Install vcpkg dependencies\n./vcpkg/vcpkg install boost-asio\n\n# Build the extension\nmake\n```\n\n## Future Enhancements\nPlanned features include:\n- Table functions for scanning Redis keys\n- Additional Redis commands (SADD, SMEMBERS, etc.)\n- Batch operations using Redis pipelines\n- Connection timeout handling\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquackscience%2Fduckdb-extension-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquackscience%2Fduckdb-extension-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquackscience%2Fduckdb-extension-redis/lists"}