Skip to content

Lens model folder setup

Quick Guide

To quickly get started with creating a Lens model in DataOS, follow the quick guide on creating a Lens model. This guide provides step-by-step instructions to help you transform your conceptual design into a functional data model, ensuring effective data structuring and organization to meet your analytical and business needs.

Prerequisites

Before setting up Lens, make sure all required dependencies are installed. Follow the Prerequisites for Lens guide for detailed instructions and resources to ensure a seamless installation and configuration process.

Lens Project Folder Structure

In the Model folder, the Lens data model will be defined, encompassing SQL mappings, logical tables, logical views, and user groups. Each folder contains specific files related to the Lens model or you can download the following template to quickly get started.

lens template

  • Open the Model folder in the preferred editor. It's recommended to place each table or view in a separate file, in model/tables and model/views folders, respectively. for example, the Model folder will have the following hierarchy:
model
├── sqls 
   └── sample.sql
├── tables 
   └── sample_table.yml //A logical table definition includes joins, dimensions, measures, and segments.
├── views 
   └── sample_view.yml //View reference dimensions, measures, and segments from tables.
└── user_groups.yml //User groups organize users for easier policy application.
  • Create sqls Folder

    • This directory will contain SQL scripts corresponding to the dimensions of tables. A dedicated SQL file needs to be maintained for each table. The SQL dialect used will be source-specific.
  • Create tables Folder

    • This directory will store logical tables, with each table defined in a separate YAML file.
  • Create views Folder

    • This directory will store all logical views.
  • Add user_groups.yml Folder

    • User groups organize users for easier policy applications to control access.
    • Presently, we have a 'default' user group defined in the YAML that includes all users.

Next Steps

Optimizing Lens testing in local development

Deploying Lens model on DataOS