Getting Started with Queries
Analytic Queries let marketers and data scientists retrieve data from the Loyalty platform, typically for the purpose of using it within a Dashboard, or to export the results for use in some other system or platform. Common use cases for Queries include counting Members or Activity records that meet certain conditions.
Note: Creating Queries in Loyalty requires proficiency in writing SQL.
The Analytics Queries screen is used to view, create, and manage your Queries. To access the Analytics Queries screen, select Analytics from the top navigation menu, then select Settings > Queries from the side navigation menu.
For more details on how to search for a Query, see
Execution Types
Loyalty supports multiple Query types, called Execution Types. Each Execution Type runs against a different data source, ans is designed for specific use cases.
Hive
Hive is the preferred Execution Type for most Queries. Hive Queries execute against a dedicated data source that is optimized specifically for analytics. This data source includes Member data, Response data, and Activity data.
For information on user-defined functions available for the Hive Execution Type, see Hive User Defined Functions.
SQL
Note: The SQL Execution Types should be used only with guidance from your Zeta team. Poorly written Queries can negatively impact your live, production database.
The SQL Execution Type executes against a transactional data source that includes information such as Responses, Challenges, Rewards, Gift Cards, and so forth.
Spark
Note: The Spark Execution Types should be used only with guidance from your Zeta team. Poorly written Queries can negatively impact your live, production database.
Spark SQL allows you to read and write data in a variety of structured formats, such as JSON, Hive Tables, and Parquet. Loyalty's real-time data is stored in Hbase, which Spark queries can access. All the Hbase data gets synchronized to Hive on a schedule throughout the day, so that queries and reports can access this data without impacting the performance of Hbase.