> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datazone.co/llms.txt
> Use this file to discover all available pages before exploring further.

# From Zero to Production!

> In this guide, you will learn how to build a Data Lakehouse from scratch using Datazone, including creating intelligent apps, deploying AI agents, and exposing data via secure endpoints.

## Prerequisites

Before you start building your Data Lakehouse, make sure you have the following prerequisites:

* A Datazone account. If you don't have one, you can sign up [here](https://app.datazone.co/app/sign-up).

* Datazone CLI installed on your local machine. You can install it by following the instructions [here](/installation).

## Task List

To understand how to build a Data Lakehouse from scratch using Datazone, let's follow these steps:

1. 🔌 **Connecting your data source**: Start by connecting AWS S3 as a data source.

2. 📁 **Initialize first project**: Set up your first project and add an Extract component.

3. 🚀 **Run first execution**: Launch your first execution to fetch data from the source.

4. 📄 **Create first pipeline**: Design a simple pipeline to process the data.

5. 🚂 **Run first pipeline**: Execute the pipeline to transform your data.

6. ⏰ **Create first schedule**: Configure periodic runs for automated processing.

7. 🧠 **Create an Intelligent App**: Turn your data pipelines into context-aware applications that observe, reason, and act — not just visualize.

8. 🤖 **Deploy an Agent**: Set up AI-powered automation for monitoring and insights.

9. 🔗 **Expose data via Endpoints**: Create secure APIs for your processed data.

10. 🏆 **Access the data**: Learn how to query and use the processed data.

## 🔌 Connect Source

1.Go to **Settings** from the top-right user menu, then select **Sources** under the **Integrations** section.

<Frame>
  <img src="https://mintcdn.com/datazone/QWQ_U-mJtu7dw2No/images/light/source/empty-source-list.png?fit=max&auto=format&n=QWQ_U-mJtu7dw2No&q=85&s=4b1a1f957b76aa22936692b2434f30b2" alt="source-empty" width="2778" height="1284" data-path="images/light/source/empty-source-list.png" />
</Frame>

1. Click on the **Create Source** button.

<Frame>
  <img src="https://mintcdn.com/datazone/YFojkVY1avf3O4H9/images/light/source/create-source-form.png?fit=max&auto=format&n=YFojkVY1avf3O4H9&q=85&s=7289e5b2d2e12d69d8be54ab70e4467b" alt="source-form" width="3840" height="2160" data-path="images/light/source/create-source-form.png" />
</Frame>

1. Fill in the required fields and click on the **Create** button. And you are done! You have successfully connected your source. Check your source in the **Settings** > **Sources** page.

<Frame
  caption={
"On next steps, we will create an extract entity to fetch data from this source."
}
>
  <img src="https://mintcdn.com/datazone/QWQ_U-mJtu7dw2No/images/light/source/create-source-success.png?fit=max&auto=format&n=QWQ_U-mJtu7dw2No&q=85&s=e31fae3c01dcd2bb46de62bc5f532162" alt="source-success" width="1920" height="1280" data-path="images/light/source/create-source-success.png" />
</Frame>

## 📁 Create Project

1. Go to the **Projects** page by clicking on the **Projects** tab in the sidebar.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/empty-project-list.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=bb35999c452f9ff993f3955938c33971" alt="source-success" width="1920" height="1080" data-path="images/light/empty-project-list.png" />
</Frame>

1. Click on the **Create Project** button.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/create-project-modal.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=40879476b8d987fbabccd0e6c8a987e9" alt="source-success" width="1920" height="1080" data-path="images/light/create-project-modal.png" />
</Frame>

1. Fill in the required fields and click on the **Create** button. Boom! 🚀 You have successfully created your first project.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/empty-project-page.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=36b259200f23daf417b101dd4aa68b9c" alt="source-success" width="1920" height="1080" data-path="images/light/empty-project-page.png" />
</Frame>

### Define your Extract

1. On your project page, click on the **Add** button in the top right corner to add a new entity.

2. Select **Extract** as the entity type.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/add-entity-modal.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=0992829d0d9e1a10ab4bd4bf39c9eb34" alt="source-success" width="1920" height="1080" data-path="images/light/add-entity-modal.png" />
</Frame>

1. Fill in the required fields and click on the **Create** button. You have successfully created your first Extract entity.

<Frame>
  <img src="https://mintcdn.com/datazone/YFojkVY1avf3O4H9/images/light/extract-form-two.png?fit=max&auto=format&n=YFojkVY1avf3O4H9&q=85&s=09512b754eb18111097ce2408d164629" alt="source-success" width="3840" height="2160" data-path="images/light/extract-form-two.png" />
</Frame>

**Base Attributes**

* `name`: The name of the extract.

* `source`: The source you want to extract data from. (It is already selected)

* `mode`: The mode of the extract. Options are;
  * `Overwrite`: Fetch all the data from the source every time.

  * `Append`: Fetch only the new data from the source.

**Source Dependent Attributes** (In this case, AWS S3). Check the [AWS S3](/sources/awss3) page for more details.

* `search_prefix`: The prefix you want to search for in the bucket.

* `search_pattern`: The pattern you want to search for in the bucket.

## 🚀 Run First Execution and Check the Data

1. Click to the created Extract entity and move to the **Executions** tab. Via clicking the **Run** button, you can start your first execution.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/execution-run-button.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=0b092cd0b6307b575b577363d095cacb" alt="source-success" width="1920" height="1080" data-path="images/light/execution-run-button.png" />
</Frame>

1. Simultaneously, you can check the execution logs and the other details in the **Logs** tab. You can cancel the execution if you want.
   After a while, execution will be completed and you notice the new dataset in left explorer. You can check the data by clicking on the dataset.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/extract-execution-finish.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=3c22ba88ae0b2a0459dc432cf7c1e80b" alt="source-success" width="1920" height="1080" data-path="images/light/extract-execution-finish.png" />
</Frame>

1. On the dataset drawer, you can see the data fetched from the source. You can also check the schema and make queries on the data to explore it.

<Frame>
  <img src="https://mintcdn.com/datazone/YFojkVY1avf3O4H9/images/light/dataset-drawer.png?fit=max&auto=format&n=YFojkVY1avf3O4H9&q=85&s=a07566e472fc2c07aa5066e097a56641" alt="source-success" width="3840" height="2160" data-path="images/light/dataset-drawer.png" />
</Frame>

1. With above way, we can fetch the other csv files from the source and create the datasets for each of them.

## ⌨️ Click Less, Code More: Create First Pipeline

If you have already created your project on the UI, open the project page and move to the "Code" section in the left tabs. For local development, clone it using the Datazone CLI.

```shell theme={null}
datazone project clone <project-id>
```

You will see:

```text theme={null}
Repository has initialized
👉 Go to repository directory: cd ecommerce-project/
```

Check your project folder

```shell theme={null}
> cd ecommerce-project/
> ls -ll
ecommerce-project/
├── README.md
├── hello-world.py
├── config.yml
```

1. We can create our pipeline file in the project folder. Let's create a new file named `order_reports.py` in the project folder.

```python order_reports.py theme={null}
from datazone import transform, Input, Dataset
from pyspark.sql import functions as F


@transform(
    input_mapping={
        "orders": Input(Dataset(alias="orders_c90dc0")),
        "order_lines": Input(Dataset(alias="order_lines_8c5238")),
        "customers": Input(Dataset(alias="customers_9cd9ab")),
    }
)
def join_tables(orders, order_lines, customers):
    return orders.join(order_lines, on="OrderID", how="inner").join(
        customers, on="CustomerID", how="inner"
    )


@transform(input_mapping={"joined": Input(join_tables)}, materialized=True)
def sales_by_country(joined):
    country_report = (
        joined.groupBy("Country")
        .agg(
            F.sum("TotalAmount").alias("TotalSales"),
            F.count("OrderID").alias("OrderCount"),
        )
        .orderBy("TotalSales", ascending=False)
    )

    return country_report


@transform(input_mapping={"joined": Input(join_tables)}, materialized=True)
def most_popular_products(joined):
    product_report = (
        joined.groupBy("ProductID")
        .agg(
            F.sum("TotalAmount").alias("TotalSales"),
            F.sum("Quantity").alias("TotalQuantity"),
            F.avg("UnitPrice").alias("AveragePrice"),
            F.count("OrderID").alias("OrderCount"),
        )
        .orderBy("TotalSales", ascending=False)
    )

    return product_report
```

Above code is a simple pipeline that joins three tables and creates two reports.

* You can see that we have two functions that are decorated with `@transform`. These functions are the steps of the pipeline.
  You can specify the input datasets and the output dataset of the function by using the `input_mapping` and `output_mapping` classes.

* The first function `join_tables` joins the `orders`, `order_lines`, and `customers` tables.

* The second function `sales_by_country` calculates the total sales and order count by country.

* The third function `most_popular_products` calculates the total sales, total quantity, average price, and order count by product.

You can create your own pipeline according to your needs. Also you can check the [Transform Functions](/transform-functions)
page to see the available functions.

1. Then you need to reference this pipeline in the `config.yml` file.

```yaml config.yml theme={null}
project_name: ecommerce-project
project_id: 673f8ef62a466524757a7de1
pipelines:
  - alias: order_reports
    path: order_reports.py
```

1. Write your code in the "Code" section of the project page and click the Deploy button.

And you will see the deployed pipeline if you click the newly created pipeline in the project page.

<Frame>
  <img src="https://mintcdn.com/datazone/QWQ_U-mJtu7dw2No/images/light/pipeline-flow.png?fit=max&auto=format&n=QWQ_U-mJtu7dw2No&q=85&s=7e63e47a09d69efa40e20bbba26e31fb" alt="source-success" width="1920" height="1080" data-path="images/light/pipeline-flow.png" />
</Frame>

1. Click the Execute button in the pipeline page.

<Note>
  There are many ways to do something in Datazone. You can run your pipeline via
  UI, CLI or API.
</Note>

1. While execution is running, you can check the logs both in the terminal and in the UI.
   After the execution is completed, you can check the logs and the output dataset in the **Executions** tab.

<Frame>
  <img src="https://mintcdn.com/datazone/Iq1Sp2O_esAW9egQ/images/light/execution-log.png?fit=max&auto=format&n=Iq1Sp2O_esAW9egQ&q=85&s=2df8bbfefbfd50d2c9dd70b948c1f109" alt="source-success" width="1920" height="1080" data-path="images/light/execution-log.png" />
</Frame>

1. Our new **Dataset** is ready to use. You can check and explore the data in the dataset drawer.

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/datazone/images/light/result-dataset.png" alt="source-success" />
</Frame>

## ⏰ Orchestrate Your Pipeline

1. Select the pipeline you want to schedule in the Explorer.

2. Open the **Schedules** tab and click on the **+ Set Schedule** button.

3. Attributes are:
   * `pipeline`: The pipeline you want to schedule. (It is already selected)

   * `name`: The name of the schedule.

   * `expression`: The cron expression for the schedule. You can use the presets or write your own.

<Frame>
  <img src="https://mintcdn.com/datazone/YFojkVY1avf3O4H9/images/light/create-schedule-modal.png?fit=max&auto=format&n=YFojkVY1avf3O4H9&q=85&s=1d3a5a7a28c860cb7d63e29bae2d61bb" alt="source-success" width="3840" height="3072" data-path="images/light/create-schedule-modal.png" />
</Frame>

## 🧠 Create an Intelligent App

At this point, your pipelines are producing reliable and structured datasets.

In Datazone, an Intelligent App is built on top of these pipelines to turn data into **context-aware applications**.

An Intelligent App can:

* Observe changes in datasets over time
* Understand relationships between entities
* Surface meaningful insights without manual queries

This layer moves your system beyond data processing and enables it to support decisions and workflows.

***

## 🤖 Deploy an Agent

Agents bring automation and intelligence into your Datazone applications.

An Agent continuously monitors selected datasets, pipelines, or executions and reacts based on context.

Typical use cases include:

* Detecting anomalies in data or execution behavior
* Monitoring pipeline health and failures
* Identifying unusual trends or patterns
* Providing proactive insights without user interaction

Once deployed, agents run continuously and become part of your production system.

***

## 🔗 Expose Data via Endpoints

After processing and enriching your data, you can expose it using Endpoints.

Endpoints allow external applications and services to securely access your datasets via APIs.

Key benefits:

* Secure access using API keys
* Controlled exposure at dataset or view level
* No direct database access required

This enables frontend applications, integrations, and services to consume trusted data safely.

## 🏆 Access the Data

### SQL Interfaces

<CodeGroup>
  ```sql Clickhouse theme={null}
  clickhouse-connect --host=app.datazone.co --port=8443 --user=your-user --password=your-password
  ```

  ```sql MySQL theme={null}
  mysql -h app.datazone.co -P 3306 -u your-user -p
  ```

  ```sql PostgreSQL theme={null}
  psql -h app.datazone.co -U your-user -d your-database
  ```
</CodeGroup>

## Related Resources

<CardGroup cols={2}>
  <Card title="Endpoint" icon="users" href="/reference/integration/endpoints">
    Create secure, controlled API interfaces for your datasets
  </Card>

  <Card title="API Keys" icon="lock" href="/reference/development/api-key">
    Generate and manage API keys for programmatic access
  </Card>

  <Card title="ODBC/JDBC Connection" icon="key" href="/reference/integration/odbc-jdbc-connection">
    Connect to Datazone using Clickhouse ODBC or JDBC drivers
  </Card>

  <Card title="Views" icon="folder" href="/reference/integration/views">
    Transform datasets into optimized relational database structures
  </Card>
</CardGroup>
