{"id":31805132,"url":"https://github.com/query-farm/redis","last_synced_at":"2025-10-11T02:46:47.903Z","repository":{"id":288757976,"uuid":"969092879","full_name":"Query-farm/redis","owner":"Query-farm","description":"DuckDB Redis Client community extension","archived":false,"fork":false,"pushed_at":"2025-09-23T19:24:45.000Z","size":58,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T21:21:14.908Z","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/Query-farm.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-19T11:17:55.000Z","updated_at":"2025-09-23T19:24:49.000Z","dependencies_parsed_at":"2025-06-13T14:26:57.507Z","dependency_job_id":"49aae5d5-097a-439c-9e57-58dbff6d10b4","html_url":"https://github.com/Query-farm/redis","commit_stats":null,"previous_names":["quackmagic/duckdb-extension-redis","query-farm/redis"],"tags_count":2,"template":false,"template_full_name":"duckdb/extension-template","purl":"pkg:github/Query-farm/redis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Query-farm%2Fredis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Query-farm%2Fredis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Query-farm%2Fredis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Query-farm%2Fredis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Query-farm","download_url":"https://codeload.github.com/Query-farm/redis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Query-farm%2Fredis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005959,"owners_count":26084004,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10-11T02:46:45.748Z","updated_at":"2025-10-11T02:46:47.893Z","avatar_url":"https://github.com/Query-farm.png","language":"C++","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## Usage\n```sql\nINSTALL redis FROM community;\nLOAD redis;\n```\n\n\u003e Experimental: USE AT YOUR OWN RISK!\n\n## Features\nCurrently supported Redis operations:\n- String operations: `GET`, `SET`, `MGET`\n- Hash operations: `HGET`, `HSET`, `HGETALL`, `HSCAN`, `HSCAN_OVER_SCAN`\n- List operations: `LPUSH`, `LRANGE`, `LRANGE_TABLE`\n- Key operations: `DEL`, `EXISTS`, `TYPE`, `SCAN`, `KEYS`\n- Batch and discovery operations: `SCAN`, `HSCAN_OVER_SCAN`, `KEYS`\n\n## Quick Reference: Available Functions\n\n| Function | Type | Description |\n|----------|------|-------------|\n| `redis_get(key, secret)` | Scalar | Get value of a string key |\n| `redis_set(key, value, secret)` | Scalar | Set value of a string key |\n| `redis_mget(keys_csv, secret)` | Scalar | Get values for multiple keys (comma-separated) |\n| `redis_hget(key, field, secret)` | Scalar | Get value of a hash field |\n| `redis_hset(key, field, value, secret)` | Scalar | Set value of a hash field |\n| `redis_lpush(key, value, secret)` | Scalar | Push value to a list |\n| `redis_lrange(key, start, stop, secret)` | Scalar | Get range from a list (comma-separated) |\n| `redis_del(key, secret)` | Scalar | Delete a key (returns TRUE if deleted) |\n| `redis_exists(key, secret)` | Scalar | Check if a key exists (returns TRUE if exists) |\n| `redis_type(key, secret)` | Scalar | Get the type of a key |\n| `redis_scan(cursor, pattern, count, secret)` | Scalar | Scan keys (returns cursor:keys_csv) |\n| `redis_hscan(key, cursor, pattern, count, secret)` | Scalar | Scan fields in a hash |\n| `redis_keys(pattern, secret)` | Table | List all keys matching a pattern |\n| `redis_hgetall(key, secret)` | Table | List all fields and values in a hash |\n| `redis_lrange_table(key, start, stop, secret)` | Table | List elements in a list as rows |\n| `redis_hscan_over_scan(scan_pattern, hscan_pattern, count, secret)` | Table | For all keys matching scan_pattern, HSCAN with hscan_pattern, return (key, field, value) rows |\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-- Get all fields and values in a hash (table)\nSELECT * FROM redis_hgetall('user:1', 'redis');\n\n-- HSCAN a hash (pattern match fields)\nSELECT redis_hscan('user:1', '0', 'email*', 100, 'redis');\n\n-- HSCAN over SCAN: for all keys matching a pattern, get all hash fields matching a pattern\nSELECT * FROM redis_hscan_over_scan('user:*', 'email*', 100, 'redis');\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)\nSELECT redis_lrange('mylist', 0, -1, 'redis') as items;\n\n-- Get all items in a list as rows (table)\nSELECT * FROM redis_lrange_table('mylist', 0, -1, 'redis');\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### Key Operations\n```sql\n-- List all keys matching a pattern (table)\nSELECT * FROM redis_keys('user:*', 'redis');\n\n-- Delete a key\nSELECT redis_del('user:1', 'redis');\n\n-- Check if a key exists\nSELECT redis_exists('user:1', 'redis');\n\n-- Get the type of a key\nSELECT redis_type('user:1', 'redis');\n```\n\n### Batch and Discovery Operations\n```sql\n-- Get multiple keys at once\nSELECT redis_mget('key1,key2,key3', 'redis') as values;\n\n-- Scan keys matching a pattern\nSELECT redis_scan('0', 'user:*', 10, 'redis') as result;\n\n-- Scan all keys matching a pattern (recursive)\nWITH RECURSIVE scan(cursor, keys) AS (\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    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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquery-farm%2Fredis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquery-farm%2Fredis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquery-farm%2Fredis/lists"}