Queries
  • 08 Jul 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Queries

  • Dark
    Light

Article summary

Overview

Most of RealTheory's APIs support the ability to use custom queries to discover and find related content through common Metadata.

Queries are written in a human-readable format that allows users to query and filter on key fields within RealTheory object and data models, typically via common Metadata.

Structure

Queries are simple, human-readable statements that can evaluate data via pre-built Functions, which can be combined together using logical operators, such as AND and OR.

Queries can include parentheses, which can be used to control the evaluation order of expressions. Expressions enclosed in parentheses have the highest evaluation precedence. Parentheses are also used to make complex expressions easier to understand.

Example

Consider the example query below:

metadata.clusterName = realtheory-cluster-01 AND (metadata.deploymentName startswith activity OR metadata.deploymentName contains helper)

This query enables the user to search for any Deployment whose name starts with 'activity' or contains the text 'helper' that is deployed on the cluster called 'realtheory-cluster-01'.

Operators and Functions

RealTheory queries can leverage the following inbuilt operators and functions

Comparison Operators

= (equals) - Evaluates the equality of two expressions, e.g. expression1 = expression2
!= (not equal to) - Evaluates whether one expression is not equal to another expression, e.g. expression1 != expression2
> (greater than) - Evaulates if one expression is greater than another, e.g. expression1 > expression2
>= (greater than or equal to) - Evaulates if one expression is greater than or equals to another, e.g. expression1 >= expression2
< (less than) - Evaulates if one expression is less than another, e.g. expression1 < expression2
<= (less than or equal to) - Evaulates if one expression is greater than another, e.g. expression1 <= expression2

Functions

StartsWith - Determines whether the beginning of a text expression matches a specified string.
EndsWith - Determines whether the end of a text expression matches a specified string.
Contains - Determines whether a text expression contains a specified string.

Logical Connectors

OR - Combines two conditions and returns TRUE if either expression is TRUE.
AND - Combines two expressions and returns TRUE when both expressions are TRUE.

Examples

metadata.clusterName contains realtheory
metadata.deploymentID = 1284d4ef-558a-4d57-8a2e-21e218f9a9f3
metadata.serviceName startswith shopping or metadata.serviceName endswith cart
metadata.clusterName = realtheory-cluster-01 AND (metadata.deploymentName startswith activity OR metadata.deploymentName contains helper

Was this article helpful?