Join us at Snowflake Summit June 26-29 in Las Vegas!

Rel Data Types Reference

Tomas Uribe and Stefan Pabst

24 November 2021

less than a minute read

We are excited to add a new reference guide to our rapidly growing documentation. The Rel Data Types Guide describes the various built-in data types in Rel along with examples of how they can be used.

The guide shows for each data type:

  • how to construct values of that data type,
  • how to test if a given value belongs to that type, and
  • common operations specific to the data type.

For instance, we can write relations with different data types, and filter on entries that have specific types:

def R = {1; 0.5; :a; 'C'; "abc"}

def output(x) = R(x) and (Char(x) or Int(x))



A Rel model does not have to specify the types of all relations in advance, since they are inferred and tracked automatically, but we still have the option to specify and enforce typed schemas using Integrity Constraints, if we choose to do so.

For example, we can specify that the relation price always relates an integer ID with a price that is stored as fixed–decimal with 2 decimals places:

ic price_types_constraint {
    subset(price, (Int, FixedDecimal[64, 2]))

These constraints can be added, removed or adjusted as your model or knowledge graph grows.

Related Posts

Get Early Access

Join our community, keep up to date with the latest developments in our monthly newsletter, and get early access to RelationalAI.