Redis Data Model

Redis is an open-source’s, high-performance, and in-memory data structure store, commonly used for caching.

Supported Redis Data Types:

  • Binary-safe Strings.

  • Lists: collections of string elements sorted according to the order of insertion. They are basically linked lists.

  • Sets: collections of unique, unsorted string elements.

  • Sorted Sets (ZSets): similar to sets but where every string element is associated to a floating number value, called score. The elements are always taken sorted by their score, so unlike sets it is possible to retrieve a range of elements (for example you may ask: give me the top 10, or the bottom 10).

  • Hashes: maps composed of fields associated with values. Both the field and the value are strings. This is very similar to Ruby or Python hashes.


Tables

Generally, querying Redis tables is the same as querying a table in a relational database. Sometimes there are special cases, for example, including a certain column in the WHERE clause might be required to get data for certain columns in the table. This is typically needed for situations where a separate request must be made for each row to get certain columns.

Keys

Returns keys present in the Redis store.

This table allows you to query all Redis keys in one place.

Columns:

NameTypeReadOnlyDescription
RedisKey [KEY]StringTrueThe name of the Redis key.
ValueIndexStringTrueVaries by type: 1 for strings; the one-based index for sets, lists, and sorted sets; or the associated field name for hashes.
ValueStringTrueThe value associated with the Redis key.
RedisTypeStringTrueThe type associated with the Redis key.
ValueScoreDoubleTrueNULL for strings, lists, sets, and hashes. Returns the associated score for sorted sets.

System Tables

You can query the system tables described in this section to access schema information, information on data source functionality, and batch operation statistics.

Schema Tables

The following tables return database metadata for Redis:

sys_catalogs

Lists the available databases.

The following query retrieves all databases determined by the connection string:

SELECT * FROM sys_catalogs

Columns:

NameTypeDescription
CatalogNameStringThe database name.

sys_schemas

  • Lists the available schemas.

The following query retrieves all available schemas:

SELECT * FROM sys_schemas

Columns:

NameTypeDescription
CatalogNameStringThe database name.
SchemaNameStringThe schema name.

sys_tables

Lists the available tables and views.

The following query retrieves the available tables and views:

SELECT * FROM sys_tables

Columns:

NameTypeDescription
CatalogNameStringThe database containing the table or view.
SchemaNameStringThe schema containing the table or view.
TableNameStringThe name of the table or view.
TableTypeStringThe table type (table or view).
DescriptionStringA description of the table or view.
IsUpdateableBooleanWhether the table can be updated.

sys_tablecolumns

Describes the columns of the available tables and views.

The following query returns the columns and data types for the Customers table:

SELECT ColumnName, DataTypeName FROM sys_tablecolumns WHERE TableName='Customers'

Columns:

NameTypeDescription
CatalogNameStringThe name of the database containing the table or view.
SchemaNameStringThe schema containing the table or view.
TableNameStringThe name of the table or view containing the column.
ColumnNameStringThe column name.
DataTypeNameStringThe data type name.
DataTypeInt32An integer indicating the data type. This value is determined at run time based on the environment.
LengthInt32The storage size of the column.
DisplaySizeInt32The designated column’s normal maximum width in characters.
NumericPrecisionInt32The maximum number of digits in numeric data. The column length in characters for character and date-time data.
NumericScaleInt32The column scale or number of digits to the right of the decimal point.
IsNullableBooleanWhether the column can contain null.
DescriptionStringA brief description of the column.
OrdinalInt32The sequence number of the column.
IsAutoIncrementStringWhether the column value is assigned in fixed increments.
IsGeneratedColumnStringWhether the column is generated.
IsHiddenBooleanWhether the column is hidden.
IsArrayBooleanWhether the column is an array.

sys_procedures

Describes the available stored procedures.

The following query retrieves the available stored procedures:

SELECT * FROM sys_procedures

Columns:

NameTypeDescription
CatalogNameStringThe database containing the stored procedure.
SchemaNameStringThe schema containing the stored procedure.
ProcedureNameStringThe name of the stored procedure.
DescriptionStringA description of the stored procedure.
ProcedureTypeStringThe type of the procedure, such as PROCEDURE or FUNCTION.

sys_procedureparameters

Describes stored procedure parameters.

The following query returns information about all of the input parameters for the SelectEntries stored procedure:

SELECT * FROM sys_procedureparameters WHERE ProcedureName='SelectEntries' AND Direction=1 OR Direction=2 Columns

Columns:

NameTypeDescription
CatalogNameStringThe name of the database containing the stored procedure.
SchemaNameStringThe name of the schema containing the stored procedure.
ProcedureNameStringThe name of the stored procedure containing the parameter.
ColumnNameStringThe name of the stored procedure parameter.
DirectionInt32An integer corresponding to the type of the parameter: input (1), input/output (2), or output(4). input/output type parameters can be both input and output parameters.
DataTypeNameStringThe name of the data type.
DataTypeInt32An integer indicating the data type. This value is determined at run time based on the environment.
LengthInt32The number of characters allowed for character data. The number of digits allowed for numeric data.
NumericPrecisionInt32The maximum precision for numeric data. The column length in characters for character and date-time data.
NumericScaleInt32The number of digits to the right of the decimal point in numeric data.
IsNullableBooleanWhether the parameter can contain null.
IsRequiredBooleanWhether the parameter is required for execution of the procedure.
IsArrayBooleanWhether the parameter is an array.
DescriptionStringThe description of the parameter.
OrdinalInt32The index of the parameter.

sys_keycolumns

Describes the primary and foreign keys.

The following query retrieves the primary key for the Customers table:

SELECT * FROM sys_keycolumns WHERE IsKey='True' AND TableName='Customers'

Columns:

NameTypeDescription
CatalogNameStringThe name of the database containing the key.
SchemaNameStringThe name of the schema containing the key.
TableNameStringThe name of the table containing the key.
ColumnNameStringThe name of the key column.
IsKeyBooleanWhether the column is a primary key in the table referenced in the TableName field.
IsForeignKeyBooleanWhether the column is a foreign key referenced in the TableName field.
PrimaryKeyNameStringThe name of the primary key.
ForeignKeyNameStringThe name of the foreign key.
ReferencedCatalogNameStringThe database containing the primary key.
ReferencedSchemaNameStringThe schema containing the primary key.
ReferencedTableNameStringThe table containing the primary key.
ReferencedColumnNameStringThe column name of the primary key.

sys_foreignkeys

Describes the foreign keys.

The following query retrieves all foreign keys which refer to other tables:

SELECT * FROM sys_foreignkeys WHERE ForeignKeyType = 'FOREIGNKEY_TYPE_IMPORT'

Columns:

NameTypeDescription
CatalogNameStringThe name of the database containing the key.
SchemaNameStringThe name of the schema containing the key.
TableNameStringThe name of the table containing the key.
ColumnNameStringThe name of the key column.
PrimaryKeyNameStringThe name of the primary key.
ForeignKeyNameStringThe name of the foreign key.
ReferencedCatalogNameStringThe database containing the primary key.
ReferencedSchemaNameStringThe schema containing the primary key.
ReferencedTableNameStringThe table containing the primary key.
ReferencedColumnNameStringThe column name of the primary key.
ForeignKeyTypeStringDesignates whether the foreign key is an import (points to other tables) or export (referenced from other tables) key.

sys_primarykeys

Describes the primary keys.

The following query retrieves the primary keys from all tables and views:

SELECT * FROM sys_primarykeys

Columns:

NameTypeDescription
CatalogNameStringThe name of the database containing the key.
SchemaNameStringThe name of the schema containing the key.
TableNameStringThe name of the table containing the key.
ColumnNameStringThe name of the key column.
KeySeqStringThe sequence number of the primary key.
KeyNameStringThe name of the primary key.

sys_indexes

Describes the available indexes. By filtering on indexes, you can write more selective queries with faster query response times.

The following query retrieves all indexes that are not primary keys:

SELECT * FROM sys_indexes WHERE IsPrimary='false'

Columns:

NameTypeDescription
CatalogNameStringThe name of the database containing the index.
SchemaNameStringThe name of the schema containing the index.
TableNameStringThe name of the table containing the index.
IndexNameStringThe index name.
ColumnNameStringThe name of the column associated with the index.
IsUniqueBooleanTrue if the index is unique. False otherwise.
IsPrimaryBooleanTrue if the index is a primary key. False otherwise.
TypeInt16An integer value corresponding to the index type: statistic (0), clustered (1), hashed (2), or other (3).
SortOrderStringThe sort order: A for ascending or D for descending.
OrdinalPositionInt16The sequence number of the column in the index.

Data Source Tables

The following tables return information about how to connect to and query the data source:

sys_connection_props

Returns information on the available connection properties and those set in the connection string.

When querying this table, the config connection string should be used:

jdbc:gathr:redis:config:

This connection string enables you to query this table without a valid connection.

The following query retrieves all connection properties that have been set in the connection string or set through a default value:

SELECT * FROM sys_connection_props WHERE Value <> ''

Columns:

NameTypeDescription
NameStringThe name of the connection property.
ShortDescriptionStringA brief description.
TypeStringThe data type of the connection property.
DefaultStringThe default value if one is not explicitly set.
ValuesStringA comma-separated list of possible values. A validation error is thrown if another value is specified.
ValueStringThe value you set or a preconfigured default.
RequiredBooleanWhether the property is required to connect.
CategoryStringThe category of the connection property.
IsSessionPropertyStringWhether the property is a session property, used to save information about the current connection.
SensitivityStringThe sensitivity level of the property. This informs whether the property is obfuscated in logging and authentication forms.
PropertyNameStringA camel-cased truncated form of the connection property name.
OrdinalInt32The index of the parameter.
CatOrdinalInt32The index of the parameter category.
HierarchyStringShows dependent properties associated that need to be set alongside this one.
VisibleBooleanInforms whether the property is visible in the connection UI.
ETCStringVarious miscellaneous information about the property.

sys_sqlinfo

Describes the SELECT queries that the connector can offload to the data source.

See SQL Compliance for SQL syntax details.

Discovering the Data Source’s SELECT Capabilities

Below is an example data set of SQL capabilities. Some aspects of SELECT functionality are returned in a comma-separated list if supported; otherwise, the column contains NO.

NameDescriptionPossible Values
AGGREGATE_FUNCTIONSSupported aggregation functions.AVG, COUNT, MAX, MIN, SUM, DISTINCT
COUNTWhether COUNT function is supported.YES, NO
IDENTIFIER_QUOTE_OPEN_CHARThe opening character used to escape an identifier.[
IDENTIFIER_QUOTE_CLOSE_CHARThe closing character used to escape an identifier.]
SUPPORTED_OPERATORSA list of supported SQL operators.=, >, <, >=, <=, <>, !=, LIKE, NOT LIKE, IN, NOT IN, IS NULL, IS NOT NULL, AND, OR
GROUP_BYWhether GROUP BY is supported, and, if so, the degree of support.NO, NO_RELATION, EQUALS_SELECT, SQL_GB_COLLATE
OJ_CAPABILITIESThe supported varieties of outer joins supported.NO, LEFT, RIGHT, FULL, INNER, NOT_ORDERED, ALL_COMPARISON_OPS
OUTER_JOINSWhether outer joins are supported.YES, NO
SUBQUERIESWhether subqueries are supported, and, if so, the degree of support.NO, COMPARISON, EXISTS, IN, CORRELATED_SUBQUERIES, QUANTIFIED
STRING_FUNCTIONSSupported string functions.LENGTH, CHAR, LOCATE, REPLACE, SUBSTRING, RTRIM, LTRIM, RIGHT, LEFT, UCASE, SPACE, SOUNDEX, LCASE, CONCAT, ASCII, REPEAT, OCTET, BIT, POSITION, INSERT, TRIM, UPPER, REGEXP, LOWER, DIFFERENCE, CHARACTER, SUBSTR, STR, REVERSE, PLAN, UUIDTOSTR, TRANSLATE, TRAILING, TO, STUFF, STRTOUUID, STRING, SPLIT, SORTKEY, SIMILAR, REPLICATE, PATINDEX, LPAD, LEN, LEADING, KEY, INSTR, INSERTSTR, HTML, GRAPHICAL, CONVERT, COLLATION, CHARINDEX, BYTE
NUMERIC_FUNCTIONSSupported numeric functions.ABS, ACOS, ASIN, ATAN, ATAN2, CEILING, COS, COT, EXP, FLOOR, LOG, MOD, SIGN, SIN, SQRT, TAN, PI, RAND, DEGREES, LOG10, POWER, RADIANS, ROUND, TRUNCATE
TIMEDATE_FUNCTIONSSupported date/time functions.NOW, CURDATE, DAYOFMONTH, DAYOFWEEK, DAYOFYEAR, MONTH, QUARTER, WEEK, YEAR, CURTIME, HOUR, MINUTE, SECOND, TIMESTAMPADD, TIMESTAMPDIFF, DAYNAME, MONTHNAME, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, EXTRACT
REPLICATION_SKIP_TABLESIndicates tables skipped during replication.
REPLICATION_TIMECHECK_COLUMNSA string array containing a list of columns which will be used to check for (in the given order) to use as a modified column during replication.
IDENTIFIER_PATTERNString value indicating what string is valid for an identifier.
SUPPORT_TRANSACTIONIndicates if the provider supports transactions such as commit and rollback.YES, NO
DIALECTIndicates the SQL dialect to use.
KEY_PROPERTIESIndicates the properties which identify the uniform database.
SUPPORTS_MULTIPLE_SCHEMASIndicates if multiple schemas may exist for the provider.YES, NO
SUPPORTS_MULTIPLE_CATALOGSIndicates if multiple catalogs may exist for the provider.YES, NO
DATASYNCVERSIONThe Data Sync version needed to access this connector.Standard, Starter, Professional, Enterprise
DATASYNCCATEGORYThe Data Sync category of this connector.Source, Destination, Cloud Destination
SUPPORTSENHANCEDSQLWhether enhanced SQL functionality beyond what is offered by the API is supported.TRUE, FALSE
SUPPORTS_BATCH_OPERATIONSWhether batch operations are supported.YES, NO
SQL_CAPAll supported SQL capabilities for this connector.SELECT, INSERT, DELETE, UPDATE, TRANSACTIONS, ORDERBY, OAUTH, ASSIGNEDID, LIMIT, LIKE, BULKINSERT, COUNT, BULKDELETE, BULKUPDATE, GROUPBY, HAVING, AGGS, OFFSET, REPLICATE, COUNTDISTINCT, JOINS, DROP, CREATE, DISTINCT, INNERJOINS, SUBQUERIES, ALTER, MULTIPLESCHEMAS, GROUPBYNORELATION, OUTERJOINS, UNIONALL, UNION, UPSERT, GETDELETED, CROSSJOINS, GROUPBYCOLLATE, MULTIPLECATS, FULLOUTERJOIN, MERGE, JSONEXTRACT, BULKUPSERT, SUM, SUBQUERIESFULL, MIN, MAX, JOINSFULL, XMLEXTRACT, AVG, MULTISTATEMENTS, FOREIGNKEYS, CASE, LEFTJOINS, COMMAJOINS, WITH, LITERALS, RENAME, NESTEDTABLES, EXECUTE, BATCH, BASIC, INDEX
PREFERRED_CACHE_OPTIONSA string value specifies the preferred cacheOptions.
ENABLE_EF_ADVANCED_QUERYIndicates if the connector directly supports advanced queries coming from Entity Framework. If not, queries will be handled client side.YES, NO
PSEUDO_COLUMNSA string array indicating the available pseudo columns.
MERGE_ALWAYSIf the value is true, The Merge Mode is forcibly executed in Data Sync.TRUE, FALSE
REPLICATION_MIN_DATE_QUERYA select query to return the replicate start datetime.
REPLICATION_MIN_FUNCTIONAllows a provider to specify the formula name to use for executing a server side min.
REPLICATION_START_DATEAllows a provider to specify a replicate startdate.
REPLICATION_MAX_DATE_QUERYA select query to return the replicate end datetime.
REPLICATION_MAX_FUNCTIONAllows a provider to specify the formula name to use for executing a server side max.
IGNORE_INTERVALS_ON_INITIAL_REPLICATEA list of tables which will skip dividing the replicate into chunks on the initial replicate.
CHECKCACHE_USE_PARENTIDIndicates whether the CheckCache statement should be done against the parent key column.TRUE, FALSE
CREATE_SCHEMA_PROCEDURESIndicates stored procedures that can be used for generating schema files.

The following query retrieves the operators that can be used in the WHERE clause:

SELECT * FROM sys_sqlinfo WHERE Name = 'SUPPORTED_OPERATORS'

Note: Individual tables may have different limitations or requirements on the WHERE clause.

Columns:

NameTypeDescription
NAMEStringA component of SQL syntax, or a capability that can be processed on the server.
VALUEStringDetail on the supported SQL or SQL syntax.

Query Information Tables

The following table returns query statistics for data modification queries, including batch operations::

sys_identity

Returns information about batch operations or single updates.

The following query retrieves the Ids of the modified rows in a batch operation:

SELECT * FROM sys_identity

Columns:

NameTypeDescription
IdStringThe database-generated Id returned from a data modification operation.
BatchStringAn identifier for the batch. 1 for a single operation.
OperationStringThe result of the operation in the batch: INSERTED, UPDATED, or DELETED.
MessageStringSUCCESS or an error message if the update in the batch failed.
Top