The primary purpose of a data warehouse is to serve as a centralized repository for historical data that can be quickly queried for BI reporting and analysis. Data modeling—which defines the database schema—is the heart of your data warehouse.
Learn more about automated dimensional modeling.
After designing your data model, the next step is to generate a physical schema, which synchronizes your model with the target database. This process is called forward engineering.
Now generating a new schema for the database is a complex task. You need to execute all the physical changes, e.g., adding, removing, or altering entities, indexes, names, and relationship types, in the destination data warehouse. On top of that, you need to align the model with native requirements of different databases.
And all this demands long, complicated scripts of coding. But where there is a complicated way, there’s also a no-code way—Astera’s way.
Automated Forward Engineering—The Astera Way
Astera DW Builder is an end-to-end data warehouse tool that comes with an intuitive, no-code platform to cut down manual data warehousing tasks by almost 80%. This includes forward engineering as well.
After you have designed your data model in Astera’s versatile data modeler, all you need to do is generate its physical schema in the desired database prior to deployment. With Astera, you get different options to forward engineer the model.
Let’s see how this is done.
This is our sample dimensional data model—designed with Astera DW Builder—based on the fictitious Wide World Importers database.
![Sample Dimensional Model in Astera DW Builder](https://www.astera.com/wp-content/uploads/2023/01/Dim-Model.png)
Fig 1. Sample Dimensional Model in Astera DW Builder
Step 1: Pick a Database of Your Choice
First, you’d select the database where you want to generate your data model schema. You treat this as your data warehouse destination where you will deploy and populate designed models.
Astera provides in-built, native support for some of the most popular data warehouse destinations and cloud providers.
Simply click on the ‘Change Database Connection Info’ icon in the toolbar and select the desired provider and database.
![](https://www.astera.com/wp-content/uploads/2023/01/Untitled-design-3.gif)
Fig 2. Selecting the desired database connection
Here, we have selected SQL server and added database details, including server and database names. Now you can automatically generate the physical schema and forward engineer your model onto the desired database.
Step 2: Verify Your Model for Forward Engineering
It’s important to verify your data model prior to forward engineering. Astera has an in-built data model verification system that automatically scans the model for any errors that can affect forward engineering or deployment.
Select ‘Verify for Forward Engineering’ option from the toolbar and see if any common errors need to be fixed in the model.
![Data Model Verification](https://www.astera.com/wp-content/uploads/2023/01/Untitled-design-10ci.png)
Fig 3. Data Model Verification
For example, two of our entities—Stock Items and Invoices—don’t have primary keys marked in their layout builders. The verification tool identifies these errors so they can be fixed prior to forward engineering and deployment.
![Verification Errors for Forward Engineering](https://www.astera.com/wp-content/uploads/2023/01/Verification-Errors.jpg)
Fig 4. Verification Errors for Forward Engineering
Mark the right column as primary key in the layout builder of both entities to get an error-free data model.
Step 3: Select Preferred Method for Forward Engineering
Astera gives you four different ways of generating a database schema.
![Forward Engineering Options](https://www.astera.com/wp-content/uploads/2023/01/Fwd-Engineering-1.jpg)
Fig 5. Forward Engineering Options
Here’s what you can do with the four options:
With this option, Aster DW Builder automatically generates an SQL script for your data model schema and executes it on the database server identified in Step 1. This way, you don’t need to manually write or generate long scripts.
‘Apply Script’ options reveal a window that shows all the changes that are applied when the script is automatically executed.
![Apply Script Window](https://www.astera.com/wp-content/uploads/2023/01/2-real.jpg)
Fig 6. Apply Script Window
We use the Diff Script option to only execute the changes we made to an existing data model. This option would only generate the Diff Script for new changes and execute it onto the database.
For example, we add a new dimension—e.g., Order Entity—to the data model and choose Apply Diff option.
![](https://www.astera.com/wp-content/uploads/2023/01/New-Dimension.jpg)
Fig 7. Adding a new entity to the dimensional model
The Apply Diff Script Window reveals only the changes that we have made to the schema.
![Apply Script Window for Apply Diff Script](https://www.astera.com/wp-content/uploads/2023/01/Apply-Diff.jpg)
Fig 8. Apply Script Window for Apply Diff Script
There’s a prompt if no changes are detected in the data model schema. For example, if we roll back the new dimension and forward engineer the data model using Apply Diff Script again, then it shows a prompt “No Changes were detected for entities”.
![No changes detected](https://www.astera.com/wp-content/uploads/2023/01/No-Changes.png)
Fig 9. No changes detected
With this option, you can automatically generate an SQL script and execute it yourself in the desired database manager. This is useful when you want to apply the script manually through Astera DW Builder. For example, we have generated a DDL SQL Script for our dimensional model as well:
![](https://www.astera.com/wp-content/uploads/2023/01/SQL-Script-2.jpg)
Fig 10. SQL script generated automatically through the Generate DDL Script option
With this option you automatically generate the Diff Script and manually execute it in the database server manager.
The data model is now ready to be deployed and consumed for BI as you have automatically generated and executed your schema through either of the four options.
This is the end of the guide to automated forward engineering with Astera DW Builder.
No complex, manual scripting and no delays in design and deployment—just hassle-free data warehouse development.
Authors:
Haris Azeem