Skip to content

Commit bf2acd1

Browse files
authored
Redis destination connector: add support for custom element_id prefixes (#603)
1 parent f705598 commit bf2acd1

File tree

7 files changed

+17
-4
lines changed

7 files changed

+17
-4
lines changed

snippets/destination_connectors/redis.sh.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ unstructured-ingest \
1212
--partition-endpoint $UNSTRUCTURED_API_URL \
1313
--additional-partition-args="{\"split_pdf_page\":\"true\", \"split_pdf_allow_failed\":\"true\", \"split_pdf_concurrency_level\": 15}" \
1414
redis \
15-
--uri $REDIS_URI
15+
--uri $REDIS_URI,
16+
--no-ssl \
17+
--key-prefix $REDIS_KEY_PREFIX \
18+
--batch-size 100
1619

1720
# Use Redis connection properties:
1821
unstructured-ingest \
@@ -30,4 +33,6 @@ unstructured-ingest \
3033
--database 0 \
3134
--username $REDIS_USERNAME \
3235
--password $REDIS_PASSWORD \
33-
--no-ssl
36+
--no-ssl \
37+
--key-prefix $REDIS_KEY_PREFIX \
38+
--batch-size 100

snippets/destination_connectors/redis.v2.py.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,8 @@ if __name__ == "__main__":
5757
username=os.getenv("REDIS_USERNAME"),
5858
ssl=False
5959
),
60-
uploader_config=RedisUploaderConfig(batch_size=100)
60+
uploader_config=RedisUploaderConfig(
61+
batch_size=100
62+
key_prefix=os.getenv("REDIS_KEY_PREFIX")
63+
)
6164
).run()

snippets/destination_connectors/redis_rest_create.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ curl --request 'POST' --location \
1212
"database": <database>,
1313
"ssl": <true|false>,
1414
"batch_size": <batch-size>,
15+
"key_prefix": "<key-prefix>",
1516
1617
# For URI authentication:
1718
"uri": "<uri>"

snippets/destination_connectors/redis_sdk.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as clien
1919
database="<database>",
2020
ssl=<True|False>,
2121
batch_size=<batch-size>,
22+
key_prefix="<key-prefix>",
2223

2324
# For URI authentication:
2425
uri="<uri>"

snippets/general-shared-text/redis-api-placeholders.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
- `<password>` (_required_ for password authentication): The database user's password.
77
- `<database>`: The number (index) for the target database. The default is `0` unless otherwise specified.
88
- For `ssl`, `true` to enable SSL encryption for the connection. Set to `true` only if SSL is already set up and enabled for the target database. The default is `true` unless otherwise specified.
9+
- `<key-prefix>`: A string to prepend to each element's `element_id`. This is useful for distinguishing between different data sets in the same Redis instance. The default is an empty string.
910
- `<batch-size>`: The maximum number of records to upload in a single batch. The default is `100` unless otherwise specified.

snippets/general-shared-text/redis-cli-api.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ The following environment variables:
2222
- `REDIS_PORT` - The database's port number, represented by `--port` (CLI) or `port` (Python).
2323
- `REDIS_DATABASE` - The database number of the target database, represented by `--database` (CLI) or `database` (Python).
2424
- `REDIS_USERNAME` - The username for the database, represented by `--username` (CLI) or `username` (Python).
25-
- `REDIS_PASSWORD` - The user's password, represented by `--password` (CLI) or `password` (Python).
25+
- `REDIS_PASSWORD` - The user's password, represented by `--password` (CLI) or `password` (Python).
26+
- `REDIS_KEY_PREFIX` - A string to prepend to each element's `element_id`, represented by `--key-prefix` (CLI) or `key_prefix` (Python).

snippets/general-shared-text/redis-platform.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ Fill in the following fields:
88
- **Password** (_required_ if **Password** is selected for **Authentication Method**): The database user's password.
99
- **Database Index**: The number (index) for the target database. The default is `0` unless otherwise specified.
1010
- **SSL**: Check this box to enable SSL encryption for the connection. Check this box only if SSL is already set up and enabled for the target database. This box is checked by default.
11+
- **Key Prefix**: A string to prepend to each element's `element_id`. This is useful for distinguishing between different data sets in the same Redis instance. The default is an empty string.
1112
- **Batch Size**: The maximum number of records to upload in a single batch. The default is `100` unless otherwise specified.

0 commit comments

Comments
 (0)