Skip to content

Conversation

zion-off
Copy link

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

This PR adds an example of using the builder pattern for to chain complex pipeline operations.

See #1744.

@zion-off zion-off mentioned this pull request Sep 20, 2025
@petyaslavova
Copy link
Collaborator

Hi @zion-off, thank you for your contribution!

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a comprehensive example demonstrating the builder pattern for chaining complex Redis pipeline operations, helping users understand how to implement fluent interfaces with Redis pipelines.

  • Adds a new notebook cell with an advanced chaining example using custom repository class
  • Implements a RedisRepository class that uses the builder pattern for method chaining
  • Demonstrates real-world usage with User and Post dataclasses for a social media-like application
Comments suppressed due to low confidence (3)

docs/examples/pipeline_examples.ipynb:1

  • Using post.title[0] as a key component will cause collisions when multiple posts have titles starting with the same character. Consider using a unique identifier like a UUID or incrementing counter instead.
{

docs/examples/pipeline_examples.ipynb:1

  • Using post.title[0] as a key component will cause collisions when multiple posts have titles starting with the same character. Consider using a unique identifier like a UUID or incrementing counter instead.
{

docs/examples/pipeline_examples.ipynb:1

  • This code could raise an IndexError if the email doesn't contain '@'. Consider adding validation or using a more robust email parsing approach for the example.
{

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +207 to +208
" if self.pipeline:\n",
" return self.pipeline.execute()\n",
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will always be true since self.pipeline is assigned in __init__ and Redis pipeline objects are truthy. Consider checking if the pipeline has commands queued or remove this check entirely.

Suggested change
" if self.pipeline:\n",
" return self.pipeline.execute()\n",
" return self.pipeline.execute()\n",

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants