# Data Store using an RDBMS Connector

{% hint style="success" %}
*Check out the illustration on the creation of Data Store.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2FVFrlKRObdXx9nTXmnWkz%2FCreating%20a%20Data%20Store%20(RDBMS).mp4?alt=media&token=7ef19105-0db4-4cae-93df-68ebde29b785>" %}

## Getting Data <a href="#getting-data" id="getting-data"></a>

* The ***Getting Data*** tab opens by default while clicking the ***Create Data Store*** option.
* Enter a name for the Data Store. The Data Connector and Database names are displayed based on the selection of the data connector.
* Provide Description for the Data Store.
* Write the SQL query in the given space (Use the ***Ctrl+ Space*** keys for assistance in writing a query.
* Put a checkmark in the given box to use the ***Enable Scheduler*** option.
* Click the ***Next*** option to proceed.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2F3L5f4hznrRJWSyOaAeRM%2Fimage.png?alt=media&#x26;token=d6edfd0c-0714-4434-8747-51dc39fce1de" alt=""><figcaption><p>Configuring the <em><strong>Getting Data</strong></em> tab</p></figcaption></figure>

## Data Type Definition <a href="#data-type-definition" id="data-type-definition"></a>

Users can define the data type using the selected data store. They can interchange the Dimensions, Measures, and Time fields by selecting the respective icons provided for these fields.

* Navigate to the ***Data Type Definition*** tab.
* Define the required ***Dimensions***, ***Measures***, and ***Time*** by interchanging the categories.
* Enable the Dimensions by using a checkmark to avail ***List of Values*** (LOV) lookup in the filter panel of the Report.
* Click the ***Next*** option to proceed.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2FyFUgIkZctK125PC8uIb5%2Fimage.png?alt=media&#x26;token=6e70ed0e-fd42-430e-8329-79f1541158d6" alt=""><figcaption><p>Configuring the <em><strong>Data Type Definition</strong></em> tab</p></figcaption></figure>

The user can change the categories of a dimension, measure, and time values by clicking the following options:

<table data-header-hidden><thead><tr><th width="130.33333333333331"></th><th width="177"></th><th></th></tr></thead><tbody><tr><td>Icons</td><td>Name</td><td>Description</td></tr><tr><td>​<img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2Fapw8cvsnZufuEHDlVChd%2Fimage.png?alt=media&#x26;token=d7498405-cea4-4777-879b-65a28dcc8aaf" alt="">​</td><td>Move to Dimensions</td><td>Moves the selected ?Measure or Time element to Dimension category.</td></tr><tr><td>​<img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FqCRgvngYEsvQE2Goqs71%2Fimage.png?alt=media&#x26;token=3cd16b7d-b1fd-4c1b-b37d-5857f0772c0d" alt="">​</td><td>Move to Measures</td><td>Moves the selected Dimension or Time element to Measure category.</td></tr><tr><td>​<img src="https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2Fa5W9PhyzhzyUIG3IwB0Q%2Fimage.png?alt=media&#x26;token=4d22f1cc-f7e5-418a-85f6-ea1a47939b5f" alt="">​</td><td>Move to Time</td><td>Moves the selected Dimension or Measure to Time category/</td></tr></tbody></table>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark> Click the **Previous** option to access the previous tab.*
{% endhint %}

## Hierarchy Definition <a href="#hierarchy-definition" id="hierarchy-definition"></a>

Define the hierarchy using various dimensions and time options.

* Navigate to the ***Hierarchy Definition*** tab.
* Click the ***Add*** option provided on the Hierarchy Definition page.
* A new ***Drill Def*** box gets added.
* Drag and drop the dimensions or time options to define a hierarchy.
  * The ***Time*** fields get separated in the 3-level granularity by dragging one time. By default, the ***Time*** dimensions can be split into **Year>Month>Date** hierarchy.
  * The ***Dimension*** fields must be dragged separately each time to create the hierarchy in the Drill Def box.
* Click the ***Next*** tab to proceed.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2F7bjo8ZOXFNlvBf0pYNrW%2Fimage.png?alt=media&#x26;token=041a20f7-94ce-48d8-bc0f-2685af253d21" alt=""><figcaption><p>Configuring the <em><strong>Hierarchy Definition</strong></em> tab</p></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*

* *Click the **Previous** option to go back to the previous tab.*
* *Click the **Remove** option (in the Drill Def box) to remove the defined hierarchy using the selected option.*
  {% endhint %}

## Batch Query <a href="#batch-query" id="batch-query"></a>

Split the data fetching process into different batches by generating a batch query.

* Navigate to the ***Batch Query*** tab.
* Select a Dimension using the drop-down menu.
* Click the ***Generate*** option.
* Based on the selected dimension, a distinct query gets generated (in the below-given box). The user can edit the distinct query as per their requirement.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2F6jt7WS1S8OvHzAUD5pN6%2Fimage.png?alt=media&#x26;token=bb4f0310-179d-40dc-9e45-593bd9a3a2e5" alt=""><figcaption><p><em><strong>Generating Distinct Query</strong></em></p></figcaption></figure>

* Click the ***Generate*** option provided for the ***Batch Query*** option.
* The original query generates the distinct query specifications to fetch data.
* Proceed to the next tab by clicking the ***Next*** tab.

<figure><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/vOFHGtsAnYhRf8q5BBeL/image.png" alt=""><figcaption><p>Generating the <em><strong>Batch Query</strong></em></p></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>*&#x20;

* *The **Batch Query*** *<mark style="color:red;">does not</mark> get generated automatically for the Data stores based on the **MongoDB**, the users need to write the batch query in the given Batch Query space. The sample Distinct Query and Batch Query examples are provided below.*&#x20;
* *The **Batch Query** page contains a **Help Center** option to get **Instructions** on how to write a **Batch Query** for the **MongoDB.***
  {% endhint %}

<details>

<summary>Mongo Distinct Query Example</summary>

```sql
db.table.aggregate([
    {
        '$group': {
            '_id': '$transmissionType'
        }
    }, {
        '$project': {
            '_id': 0, 
            'transmissionType': '$_id'
        }
    }
])
```

</details>

<details>

<summary>Mongo Batch Query Example</summary>

```sql
db.testdata.aggregate(db.testdata.aggregate([
                                   {
        '$project': {
            '_id': 0
        }
    },{"$match":{"transmissionType":?}}
]))
```

```sql
db.testdata.aggregate([
    {
        "$project": {
            "_id": 0
        }
    }
])
```

</details>

<details>

<summary>Help Center option for MongoDB Batch Query</summary>

* Navigate to the ***Batch Query*** tab.
* Click the ***Help Center*** icon.

&#x20;      ![](https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/P8NIKvCxIJ4eNGczkNAn/image.png)&#x20;

* The ***Instructions*** window opens displaying the Distinct Query and Batch Query examples for a Mongo DB based Data Store.

  **Distinct Query**

&#x20;      ![](https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/n0JlUcnHUdtQzVett969/image.png)          &#x20;

&#x20;       **Batch Query**

&#x20;      ![](https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/t9wkyXaaEoPA88AxIyHR/image.png)

</details>

## Data Restrictions <a href="#data-restriction" id="data-restriction"></a>

Configure the ***Data Restrictions*** settings to restrict a user-level view of the data store.

* Navigate to the ***Data Restriction*** tab.
* Click the ***Add*** icon to add a new box for inserting the data restriction parameter.
* Select a dimension from the drop-down menu.
* Enter the user/group-specific custom field to restrict the data.
* Click the ***Next*** option to proceed.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2F76r8N3PHBHsH6TlhdqZG%2Fimage.png?alt=media&#x26;token=8599639a-2a2a-42a2-99e9-54e1ee55a5a2" alt=""><figcaption><p>Configuring the <em><strong>Data Restrictions</strong></em> tab</p></figcaption></figure>

{% hint style="info" %}
*<mark style="color:green;">Please Note:</mark>* The Administrator can restrict data access for specific users by configuring the User Property via the Data Restriction tab. For instance, if a custom field 'Country' is set to 'India' for a user or user group, and the administrator uses this field while creating a data store, only those users can access data related to India.
{% endhint %}

## Scheduling Data Refresh <a href="#scheduling-data-refresh" id="scheduling-data-refresh"></a>

The user can schedule a data refresh interval via the ***Schedule Data Refresh*** tab.

* Navigate to the ***Schedule Data Refresh*** tab. (This tab only appears for the Data Stores where the scheduler has been enabled using the ***Getting Data*** tab).
* Define a time range to refresh data using the following options:

  * Hourly&#x20;
  * Daily (default option)
  * Weekly
  * Monthly
  * Yearly

  (Select any one option from the above-given list to set the data refresh interval)
* Enable the ***Refresh Now*** option by using a checkmark in the given box.
* Enable the ***Email Notification*** option by providing a checkmark in the box.
  * Provide a valid email address to receive the notification email regarding the Data Store.
* Click the ***Finish*** option to complete the Data Store creation process.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2FddJhT2G5THuHGaMToclV%2Fimage.png?alt=media&#x26;token=7aee501f-70cb-44b1-91ed-29ebea67af97" alt=""><figcaption><p>Configuring the <em><strong>Schedule Refresh</strong></em> tab</p></figcaption></figure>

* A message appears to confirm that the data store configuration has been saved.
* The ***Data Stores*** ***List*** opens.
* A new ***Data Store*** gets created and added to the displayed list.

<figure><img src="https://2396355452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7P9Uf1O3iaFlsO3hfWI%2Fuploads%2FBZMTRB8PxwKkOfX2gTpe%2Fimage.png?alt=media&#x26;token=debc4a82-d785-49dc-b2e5-970171653005" alt=""><figcaption><p><em>New Data Store gets added to the Data Stores List</em></p></figcaption></figure>

<table data-header-hidden><thead><tr><th width="183.33333333333331"></th><th width="242"></th><th></th></tr></thead><tbody><tr><td>Icon</td><td>Name</td><td>Task</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/jIIuklAVO4XXUgI8x21p/image.png" alt="" data-size="original"></td><td>View/Edit</td><td>Opens the Data Store in editable format the datastore fields.</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/GP1kej7hnz3Bh5nLLPfA/image.png" alt="" data-size="original"></td><td>Refresh Data</td><td>Refreshes data for a datastore.</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/8jX6wqrma4E0r9BT3Hfd/image.png" alt="" data-size="original"></td><td>Latest Scheduled Status</td><td>Displays the latest scheduler status via a pop-up window.</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/IrfB60ii8Dck9vhW5kBX/image.png" alt="" data-size="original"></td><td>Share Data</td><td>Shares a datastore to/for the selected user(s) or group(s).</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/I9GEQH9074WdV5PrESHp/image.png" alt="" data-size="original"></td><td>Add Synonyms to Data Store</td><td>Adds more synonyms to a Data Store.</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/Cjjpf8qhlpYKrT8378XQ/image.png" alt="" data-size="original"></td><td>Refresh Synonyms</td><td>Refreshes Synonyms for the selected Data Store.</td></tr><tr><td>​​<img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/4I9SUFwcZrOFiB85270n/image.png" alt=""></td><td>Push to VCS</td><td>Pushes the Data Store to the GIT repository.</td></tr><tr><td>​​<img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/p48nwIWULBr78Di7Ij2H/image.png" alt=""></td><td>Pull From VCS</td><td>Pulls the Data Store to the GIT repository.</td></tr><tr><td>​​<img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/WURgrS9b9k4r2KVvbqCp/image.png" alt=""></td><td>Delete</td><td>Deletes the selected Data Store.</td></tr><tr><td><img src="https://content.gitbook.com/content/e7P9Uf1O3iaFlsO3hfWI/blobs/7fL0yQX25Wxh0uy8AOn6/image.png" alt="" data-size="original"></td><td>Visualize</td><td>Redirects the user to Widget  Visualizer page.</td></tr></tbody></table>


---

# 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.bdb.ai/data-center-5/data-center/data-stores/creating-a-new-data-store/data-store-using-an-rdbms-connector.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.
