# Getting Set Up for Data Modeling

Embeddable supports defining your models either:

1. **in-platform**, in Embeddable's low-code **Data Model Editor**, or
2. **in code**, directly in your code repository.

## Defining models in the Data Model Editor

To start using the data model editor simply make sure that you've [set up your workspace](https://docs.embeddable.com/getting-started/get-set-up/your-workspace) and then head to the **Data Model Editor** tab:

Your first data model:

1. Click the **+ button** in the top left section to create your first data model, 
1. Give your model a **name** 
1. Enter the name of a **SQL table** in your database or provide a starting SQL **SELECT statement**.
1. Learn more [here](https://docs.embeddable.com/data-modeling/writing-data-models/defining-models).
1. Learn how to connect your database [here](https://docs.embeddable.com/data/connect-your-database).

## Defining models in code

You can define your data models in individual files using **YAML** or **JavaScript**. Generally, YAML is recommended for its simplicity and readability. (See [Cube’s documentation](https://cube.dev/docs/product/data-modeling/overview) if you prefer JavaScript-based models.)

Embeddable supports two options for storing your models in code:
1. **In the same repository** as your charting components (like [this](https://github.com/embeddable-hq/remarkable-pro-boilerplate/tree/main/src/embeddable.com/models)).
2. **In a separate repository** on its own (like [this](https://github.com/embeddable-hq/only-models)).

### 1. Storing Models with Your Components

If you prefer an all-in-one approach, you can keep both your models and charting components in a single repository. This is ideal if a single team manages everything or you want an easy, consolidated project structure.

For a reference setup, take a look at our [starter repo](https://docs.embeddable.com/getting-started/get-set-up/set-up-your-workspace). It demonstrates a typical way to organize your files. 

This is the default and requires no extra set up.

### 2. Storing Models Separately

If the team who will be creating the data models is a separate team to the team maintaining the javascript components, then it can be beneficial to store your models and components in separate code repositories. By separating them:

- You can version and push each set of files independently.
- You can work on model updates without interfering with UI components, and vice versa.

You can see an example of a [dedicated models repo here](https://github.com/embeddable-hq/only-models/tree/main).

Importantly, you'll need to update `embeddable.config.ts` to include:
```tsx
pushModels: true,
pushComponents: false
```
- This ensures that, when you [push your models](https://docs.embeddable.com/getting-started/development/pushing-code) to your Embeddable workspace, only relevant model files are sent. 

- Importantly, this also includes any [security context presets](https://docs.embeddable.com/data-modeling/row-level-security/security-filters#testing-your-security-filters) you've created to test row-level security.

---
Source: https://docs.embeddable.com/data-modeling/getting-setup
