# Setting up data models

This is the last step before data cards can be created and is the one that brings most value to data analysis. Any data card needs a data model in order to run queries.

You must create a data model by clicking the "Add" button in the list of Data Models in the Data Center.

In this case, our data is stored in a PostgreSQL database, so the data is not managed by Biuwer but by our organization. For this reason, we have to create a "Not Managed" model, as Biuwer does not manage this data. For this example we have called "Rental Basic", using the "Film rental DB" connection as the data source.

![Creating a not managed data model in Biuwer](/files/-MMzuq1hdMfoJgbhmeEx)

We must then add datasets and relationships between them. For this, it is necessary to know how the data are stored and how they relate to each other. You can use the record viewer of datasets to see a preview of the data and in case you need to relate the data, know by which fields this association should be made.

We need the following datasets for the example we are looking at:

* **rental**: this is the so-called fact table, in theoretical Business Intelligence terminology, in which rentals are stored, with their dates (rental\_date), customer codes (customer\_id) and inventory code (inventory\_id).
* **customer\_list**: is a table that acts as a dimension, in theoretical Business Intelligence terminology, in which customers are stored with a unique identifier (id) and among other information, the customer's name, country and city.
* **film\_list**: this is also a dimension table, in which films are stored with a unique identifier (fid), and among others, a title and its price.
* **category**: this is also a dimension table, in which categories of films are stored with a unique identifier (category\_id) and their name.
* **inventory**: this table can be called a relationship table, as it serves to define the physical inventory of films in various available shops. It therefore contains only identifiers and must be included in relationships.

{% hint style="info" %}
Usually, if the physical data model is well defined, we should use at least N-1 relationships between N datasets included in the model.
{% endhint %}

You can access the Data Center Data Models section to see precisely this same example.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.biuwer.com/creating-a-dashboard/setting-up-data-models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
