# Reverse Engineering an Existing Database

Reverse engineering is the process of constructing a data model from an existing database. When you reverse engineer a database in Astera Data Stack, it creates a logical structure that incorporates the tables in the database, and the relationships between them. In essence, It synchronizes the data model with the database and its entities.

### Video

{% embed url="<https://youtu.be/xWSDUnLHv0U>" %}

### Overview

There are two ways to reverse engineer a database in Astera Data Stack. One is from the toolbar on the data model designer and the other one is from the main menu.

Let’s explore each, one by one.

### Reverse Engineer: Using the Tool Bar Icon

On the toolbar of the data model designer, there is an icon for reverse engineering.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/i34z0kkkxAExVmApJ4ZU/01-Reverse-Engineer-Tool-Bar.png)

### Reverse Engineer: Using the Main Menu

On the main menu bar of Astera Data Stack, there is an option for *Data Model > Reverse Engineer*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/cARnpRpFmWUXQRLtlBuU/02-Reverse-Engineer-Main-Menu.png)

Once you select either of these two options, a *Reverse Engineering* wizard will open on the screen.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/dzxDkYUCNiX8GHxHmygs/03-Reverse-Engineering-Wizard.png)

In case you haven’t established a database connection earlier, specify a connection from within the *Reverse Engineering* wizard.

Click on the ellipses in front of the *Database Connection* option. A *Database Connection* screen will open.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/PQFdFv1rKajcMcM0jGoB/04-Database-Connection-Ellipses.png)

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/LcbQUGXxxMVIf5jWF2jb/05-Database-Connection-Wizard.png)

On this screen, select the data provider for the database and fill in the required credentials. Once done, click *OK*.

There is a list of data providers that Astera Data Stack supports.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/IVHHTCpKJOTQy01orzmA/06-Data-Provider-Database.png)

{% hint style="info" %}
**Note**: In this case, we will select SQL Server as our database provider.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/KgTZl87GlCPZjS3gP6Jj/07-Database-Connection-Credentials.png)

Now, all the tables in the database have been listed as *Entities* on the Reverse Engineering wizard.

The following information is available for each entity:

* Exist? - Identifies if the entity already exists in the model
* Type - Specifies the type of the entity in the database (Example: Table)
* Schema - Represents the schema that the entity belongs to in the database
* Name - Name of the entity in the database

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/n2a1J2hUL7yB2nWW5EY8/08-Database-Entities.png)

Select the entities that you want to reverse engineer in the data model.

{% hint style="info" %}
**Note**: In this case, we are selecting all the listed entities.
{% endhint %}

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/CGkleORgIAscHfVFONeo/09-Selecting-Entities.png)

On the *Reverse Engineering* wizard, there is a *Search* option that can be used when there are numerous listed entities and specific entities are to be reverse engineered from the database.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/JsrjMPhBcYfzCEMPe3Xi/10-Search-Entities.png)

There is also an option to filter out listed entities for each information type provided. Upon selecting the filter, it would open a new wizard where you can specify filter options.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/gcwJI47kdSuQYp2P3ryp/11-Filter-Entities.png)

Once you’ve selected the entities for reverse engineering, click *OK*.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/eZC4Z5lT74pKLz4kYlBC/12-Close-Reverse-Engineering.png)

When the process is complete, the selected entities from the database will appear on the data model designer.

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/vDRJRGgTQsxerdz5btTa/13-Reverse-Engineered-Database.png)

This concludes our discussion on reverse engineering an existing database in Astera Data Stack.

<br>
