String

The String data type stores sequences of characters of any length. There is no predefined limit to the length of a String value. It can contain any sequence of bytes, including null bytes. This type serves as a versatile replacement for various string and binary types found in other database systems, such as VARCHAR, BLOB, and TEXT.

While you might encounter syntax like VARCHAR(255) when defining string fields in other systems, Tinybird (and ClickHouse) ignores any numeric length parameters specified for String types.

Aliases:

  • String: LONGTEXT, MEDIUMTEXT, TINYTEXT, TEXT, LONGBLOB, MEDIUMBLOB, TINYBLOB, BLOB, VARCHAR, CHAR, CHAR LARGE OBJECT, CHAR VARYING, CHARACTER LARGE OBJECT, CHARACTER VARYING, NCHAR LARGE OBJECT, NCHAR VARYING, NATIONAL CHARACTER LARGE OBJECT, NATIONAL CHARACTER VARYING, NATIONAL CHAR VARYING, NATIONAL CHARACTER, NATIONAL CHAR, BINARY LARGE OBJECT, BINARY VARYING,

Encodings

Tinybird does not enforce specific character encodings for String data. Strings are stored and output exactly as they are provided, as raw sequences of bytes. For text data, it is highly recommended to use UTF-8 encoding. This ensures compatibility and proper display, especially when interacting with terminals or applications that expect UTF-8.

Some string functions offer variations that operate under the assumption that the string contains UTF-8 encoded text. For instance, the length function calculates the number of bytes in a string, whereas lengthUTF8 determines the number of Unicode code points, assuming the input is UTF-8.

Working with JSON objects

JSON objects can be ingested as a String data type. You can ingest your JSON data as a String and use JSON functions to parse the specific fields you need. To optimize performance, you can store these parsed values in Materialized Views.

Updated