Properties (Community)

Last Updated: 2021-02-11

Now that you have a Source or some Sources (see here if you don't have a Source), you can begin to define additional Profile Properties. Profile Properties are data values associated to the Profiles you have in Grouparoo. See this doc to learn more about the core concepts in Grouparoo.

Generating a New Property

You are likely to have more Profile Properties than any other type of config object in your Grouparoo application. Because of this, creating them with the CLI can be a tedious venture. While we still recommend using the CLI, we've outlined two approaches to take when creating Properties.

Method #1: Using the CLI

To generate a new Property for your Grouparoo application, you can run the generate command.

For example, let's say you have configured a Postgres Table Source with the ID users. And let's say you want to add a Property that calculates the lifetime value of each customer. You can generate a new Profile for that Source like this:

grouparoo generate postgres:table:property ltv --parent users_table

Note here that ltv is the ID for the Source. An ID is always required when generating a config object.

This command will generate a file in your application directory at config/properties/ltv.js that looks something like this:

exports.default = async function buildConfig() {
  return [
    {
      id: "ltv",
      name: "ltv",
      class: "property",
      sourceId: "...",
      type: "string",
      unique: true,
      identifying: true,
      isArray: false,
      options: {
        column: "...",
        aggregationMethod: "exact",
        sort: null,
      },
      filters: [],
    },
  ];
};

The shape of the object(s) returned by the function will look different depending on the type of Property generated. More on this below.

Method #2: Duplicating Existing Code

Because you are likely to create several Properties for any given source, you don't have to use the CLI for each one. You could choose to create a single Property, and then duplicate the code for any additional Properties, changing values as necessary.

And you also don't need an individual file for each Property object. You could choose to shove all Properties for a source in a single file, or even in the Source's file. Grouparoo's CLI is smart enough to figure out which objects to load first. Your config objects can be in any directory, just as long as they are JavaScript or JSON files.

List of Available Source Types

A Postgres table Property is just one type of Property you can create. To see a full list of available types, use the --list option, filtered by "property":

grouparoo generate property --list

This will give you something like the following:

bigquery:query:property (id, parent) - Config for a bigquery Query Property
bigquery:table:property (id, parent) - Config for a bigquery Table Property
csv:property (id, parent) - Config for a CSV Property
events:property (id, parent) - Config for a Grouparoo Property based on an Events Source
google-sheets:property (id, parent) - Config for a Google Sheets Property
mailchimp:property (id, parent) - Config for a Mailchimp Property
manual:property (id, parent) - Config for a Grouparoo Property based on a Manual Source
mysql:query:property (id, parent) - Config for a mysql Query Property
mysql:table:property (id, parent) - Config for a mysql Table Property
postgres:query:property (id, parent) - Config for a postgres Query Property
postgres:table:property (id, parent) - Config for a postgres Table Property
redshift:query:property (id, parent) - Config for a redshift Query Property
redshift:table:property (id, parent) - Config for a redshift Table Property
snowflake:query:property (id, parent) - Config for a snowflake Query Property
snowflake:table:property (id, parent) - Config for a snowflake Table Property

Configuring Your Property

The generate command attempts to make a reasonable guess at the values in the config file it generated (in the config/properties directory). There are ellipses ("...") in the places in which it couldn't make a reasonable guess. In the example above, after generating a Property for a Postgres Source, all but sourceId and options.column were pre-populated.

Other sections may be commented out but require some action by you. The best practice when configuring an Property is to read the comments, keys, and values within the generated file and fill in the appropriate values for your Property.

Validating & Applying Your Config

You can validate your config at any time using the validate command:

grouparoo validate

And you can apply that config (save it to your Grouparoo application's database) using the apply command:

grouparoo apply

Note that apply will run validate, but it's recommended to run validate on its own first, just to be safe.