Complete reference for defining your Data Catalog resources using YAML configuration files.
Available Plans
free
starter
growth
enterprise
7 minute read
This guide shows you how to define a data catalog project using YAML files that contain the definitions of your data catalog resources.
Overview
In the context of the Rudder CLI (rudder-cli) tool, a data catalog project typically consists of a root directory that contains all the project files. Within this root directory, each YAML file can contain definitions for resources of a particular type, for example, events, properties, custom data types, and tracking plans.
The location and naming of these YAML files is flexible, as you can store the YAML files anywhere within the project’s root directory or subdirectories.
You can also group some resources of the same type in the same file, allowing structures that can best serve your project’s requirements. For example, you could have:
A events.yaml file in the project’s root directory that defines multiple events.
Another file subdirectory/user-events.yaml that defines addtional events.
The Rudder CLI tool processes all valid YAML files within the project structure to recognize the defined resources.
The following sections detail the specific YAML formats and parameter definitions for each data catalog resource type.
Events
You can define one or more events in the YAML file by setting kind to events.
The spec parameter of the YAML file has the following structure:
An array of event definitions grouped together in the same file.
Event definition
The event definitions have a structure that depends on the event type. All definitions share some common properties, as listed in the below table:
Property
Type
Description
id Required
String
Unique identifier for the event within the project. This parameter must be unique across all events.
event_type Required
String
Event type. Acceptable values are track, identify, page, screen, and group.
description
String
Event description.
Additionally, track events (event_type: track) also support the following property:
Property
Type
Description
name Required
String
The track event name. In other words, this parameter corresponds to the event property of the corresponding RudderStack track event.
Example
version:rudder/0.1kind:eventsmetadata:name:myeventgroupspec:events:- id:product_viewedname:"Product Viewed"event_type:trackdescription:"This event is triggered every time a user views a product."- id:added_to_cartname:"Added To Cart"event_type:trackdescription:"This event is triggered every time the user adds a product to their cart."- id:identifyevent_type:identifydescription:"An event that identifies the user."- id:pageevent_type:page
Properties
You can define one or more properties in the YAML file by setting kind to properties.
The spec parameter of the YAML file has the following structure:
Additional validation rules for the property’s values.
Property config
Property
Type
Description
minLength
Integer
Minimum length of the property’s string value.
maxLength
Integer
Maximum length of the property’s string value.
pattern
String
Regular expression that the property’s string values need to match with.
enum
Array of strings
List of all valid values for the property.
Example
version:rudder/v0.1kind:propertiesmetadata:name:ecommerce_propertiesspec:properties:- id:product_idname:"product_id"type:stringdescription:"Unique identifier for the product."propConfig:minLength:3maxLength:64- id:product_namename:"product_name"type:stringdescription:"Name of the product."propConfig:minLength:2maxLength:255- id:product_pricename:"product_price"type:numberdescription:"Price of the product in the store's currency."- id:product_categoryname:"product_category"type:stringdescription:"Category the product belongs to."propConfig:enum:- "clothing"- "electronics"- "home_goods"- "beauty"- "accessories"maxLength:60- id:cart_itemsname:"cart_items"description:"Items present in the cart."type:arraypropConfig:minItems:1uniqueItems:false
Custom data types
You can define custom data types in the YAML file by setting kind to custom-types.
The spec parameter of the YAML file has the following structure:
An array of custom type objects grouped together in the same file.
Custom type definition
Property
Type
Description
id Required
String
Unique identifier for the custom type within the project. This parameter must be unique across all custom types in all the YAML files within the project.
Validation rule that determines whether the property should always be present in the RudderStack event.
Default value: false
Example
version:rudder/0.1kind:tpmetadata:name:ecommerce_tracking_planspec:id:ecommerce_tracking_plandisplay_name:"E-commerce Tracking Plan"description:"Tracking plan for an e-commerce application."rules:- type:event_ruleid:product_viewed_ruleevent:$ref:"#/events/myeventgroup/product_viewed"allow_unplanned:falseproperties:- $ref:"#/properties/ecommerce_properties/product_id"required:true- $ref:"#/properties/ecommerce_properties/product_name"required:true- $ref:"#/properties/ecommerce_properties/product_price"required:true- $ref:"#/properties/ecommerce_properties/product_category"required:false- type:event_ruleid:added_to_cart_ruleevent:$ref:"#/events/myeventgroup/added_to_cart"allow_unplanned:falseproperties:- $ref:"#/properties/ecommerce_properties/product_id"required:true- $ref:"#/properties/ecommerce_properties/product_name"required:true- $ref:"#/properties/ecommerce_properties/product_price"required:true- $ref:"#/properties/ecommerce_properties/cart_items"required:true
Reference catalog resources
Definitions in a YAML file can refer to definitions in other files by using the resource reference ($ref) strings—this is useful while defining resources like tracking plans which need to be associated with events and properties defined in other files.
Note that references must always start with a # character followed by the path using the / delimiter. The path can point to a unique resource within a project’s file and is expected to have the following components in order:
kind value of the target resource’s file, that is, events, properties, or tp.
metadata.name value of the target resource’s file.
id value of the target resource.
For example, you can refer an event inside a file with metadata.name set to examples and having id as example_id as follows:
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.