TDV Adapter for Redis

Build 22.0.8462

CreateSchema

Creates a custom schema file based on the specified columns.

Define Tables Manually

It is also possible to define the fields and patterns of a table directly using the adapter's CreateSchema stored procedure. The table definitions generated by CreateSchema are plain text configuration files that are easy to extend.

To create a schema, you can invoke the CreateSchema procedure using EXECUTE. It accepts these five parameters:

  • TableName is the name of the table to be created.
  • KeyPattern contains a key pattern as described in rpgusingproperties.
  • Columns contains a column separated list of names, not including RedisKey. These will be used as the attributes of any hashes inserted into the table.
  • Description is optional, and contains a free-form note about the table. If not provided, it will be left blank.
  • OutputFolder is optional, and contains the path of the folder the schema file is written to. If not provided, the Location connection property is used.

For example, you can create a basic schema using a query like this:

EXECUTE CreateSchema TableName='users', KeyPattern='user:*', Columns='name,email,password'

Once a schema has been defined, it can be used as a table in SELECT, INSERT, UPDATE or DELETE statements. Any values inserted into the table will be formatted as hashes. For example, the query:

INSERT INTO users(RedisKey, name, email, password) VALUES ('user:1000', 'John Smith', 'john.smith@example.com', 's3cret')

Will generate this Redis command:

hmset user:1000 name "John Smith" email "john.smith@example.com" password "s3cret"

Input

Name Type Required Accepts Output Streams Description
TableName String True False The name for the new table.
KeyPattern String True False The Redis Key pattern for table.
Columns String True False A comma-separated list of columns to include in the schema file.
Description String False False An optional description for the table.
WriteToFile String False False Whether to write the contents of this stored procedure to a file or not (Default = true) needs to be set to false to output FileStream of FileData
FileStream String False True An instance of an output stream where file data is written to. Only used if WriteToFile is set to False.

Result Set Columns

Name Type Description
Success String Whether or not the schema was created successfully.
SchemaFile String The generated schema file.
FileData String File data that will be outputted encoded in Base64 if the WriteToFile=False and FileStream inputs are not set.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462