Skip to main content

Creating a Model

Setting up your first SQL model#

To build your first model select the add Model button in the top right corner of your screen.

Empty Models Page

A dialogue box will appear with the inputs required to build your model.

Model Dialogue Box

Fill in the following:

Type#

Select Model if you are creating a standard SQL data model. Select Sensor if you are creating a SQL sensor (more on that here).

Name#

Select a name for your model. There are a few rules to creating a name:

  • No more than 32 characters long
  • Use lowercase letters
  • Use numbers but not as the first character
  • Include underscores (ie. snake_case)

Description#

Write a description about your model. You can always come back and edit this.

Pipeline#

Select a pipeline for the model. You can change this at any time.

Export Targets#

Export targets allow you to send data to destinations outside of your data warehouse. For example, an S3 bucket or the Facebook Ads API. Currently these are custom integrations and can be requested through your account manager.

Template#

Templates allow you to work with prewritten code. Select a template to populate the SQL editor. Templates make it easier to start building queries. You can find out more about templates and how to build them in the Templates tutorial here.

SQL Editor#

Here is where you write or edit SQL query. For your first query let's make it a small and simple dataset that will populate quickly in your data warehouse.

Dependencies#

Dependencies are other models that the current model is dependent on. This is vital to making great pipelines as it tells FloSQL what models to run before other models. We have a unique feature that scripts through the query and populates all existing models in the dependency section. See the image below for this in action.

Since this is your first model there can not be a dependency to map to.

Automatic Dependency Mapping

Outside Dependencies#

These are dependencies that do not exist as models within your current FloSQL instance. They will automatically populate and are uneditable. If a table does not have a schema "public" will be automatically applied to it for mapping purposes.

See Variables Button#

The see variables button opens a dialogue box that displays your query with all the variables filled in. More on how variables work and can be used in the Variables section here.

Once you are complete filling in your model you can press the 'Save' button to save and create the model. The dialogue box will close and a new model will populate in both the model in the flow chart below.

Outside Dependencies#

These are dependencies that do not exist as models within your current FloSQL instance. They will automatically populate and are uneditable. If a table does not have a schema "public" will be automatically applied to it for mapping purposes.

See Variables Button#

The see variables button opens a dialogue box that displays your query with all the variables filled in. More on how variables work and can be used in the Variables section here.

Once you are complete filling in your model you can press the 'Save' button to save and create the model. The dialogue box will close and a new model will populate in both the model in the flow chart below.

Your First Model

๐Ÿ’ฏ Great! You know have your first model. Now let's get this model into your data warehouse.

Build the model in your data warehouse#

There are several stages in which you put your model. More on that in the links below. Since it's your first model, let's get it into review and then to production.

Open the drop down of your model to open your editor. Select the Promote To Review button from the selection at the bottom of the editor.

Edit Mode Buttons

This will begin creating a model in the Review schema. We'll explain more about this later. For now, let's send it into production immediately following this. Select the Send To Production button from the selection at the bottom of the editor.

Review Mode Buttons

Your model will turn blue in both the models list and the flow chart. This means it's in production and ready to run. Let's get it to start running!

First Production Model