Skip to main content

prefect_redis.tasks

Prebuilt Prefect tasks for reading and writing data to Redis

Functions

redis_set

Set a Redis key to a any value. Will use cloudpickle to convert value to binary representation. Args:
  • credentials: Redis credential block
  • key: Key to be set
  • value: Value to be set to key. Does not accept open connections such as database-connections
  • ex: If provided, sets an expire flag in seconds on key set
  • px: If provided, sets an expire flag in milliseconds on key set
  • nx: If set to True, set the value at key to value only if it does not already exist
  • xx: If set tot True, set the value at key to value only if it already exists

redis_set_binary

Set a Redis key to a binary value Args:
  • credentials: Redis credential block
  • key: Key to be set
  • value: Value to be set to key. Must be bytes
  • ex: If provided, sets an expire flag in seconds on key set
  • px: If provided, sets an expire flag in milliseconds on key set
  • nx: If set to True, set the value at key to value only if it does not already exist
  • xx: If set tot True, set the value at key to value only if it already exists

redis_get

Get an object stored at a redis key. Will use cloudpickle to reconstruct the object. Args:
  • credentials: Redis credential block
  • key: Key to get
Returns:
  • Fully reconstructed object, decoded brom bytes in redis

redis_get_binary

Get an bytes stored at a redis key Args:
  • credentials: Redis credential block
  • key: Key to get
Returns:
  • Bytes from key in Redis

redis_execute

Execute Redis command Args:
  • credentials: Redis credential block
  • cmd: Command to be executed
Returns:
  • Command response