Skip to main content

prefect.blocks.redis

Classes

RedisStorageContainer

Block used to interact with Redis as a filesystem Attributes:
  • host: The value to store.
  • port: The value to store.
  • db: The value to store.
  • username: The value to store.
  • password: The value to store.
  • connection_string: The value to store.
Methods:

aread_path

Read the redis content at path Args:
  • path: Redis key to read from
Returns:
  • Contents at key as bytes, or None if key does not exist

awrite_path

Write content to the redis at path Args:
  • path: Redis key to write to
  • content: Binary object to write
Returns:
  • True if the key was set successfully

block_initialization

from_connection_string

Create block from a Redis connection string Supports the following URL schemes:
  • redis:// creates a TCP socket connection
  • rediss:// creates a SSL wrapped TCP socket connection
  • unix:// creates a Unix Domain Socket connection
See [Redis docs](https://redis.readthedocs.io/en/stable/examples /connection_examples.html#Connecting-to-Redis-instances-by-specifying-a-URL -scheme.) for more info. Args:
  • connection_string: Redis connection string
Returns:
  • RedisStorageContainer instance

from_host

Create block from hostname, username and password Args:
  • host: Redis hostname
  • username: Redis username
  • password: Redis password
  • port: Redis port
Returns:
  • RedisStorageContainer instance

read_path

Read the redis content at path Args:
  • path: Redis key to read from
Returns:
  • Contents at key as bytes, or None if key does not exist

read_path

write_path

Write content to the redis at path Args:
  • path: Redis key to write to
  • content: Binary object to write
Returns:
  • True if the key was set successfully

write_path