Data Build Tool: Installation on Windows and Connect Database

Data Build Tool: Installation on Windows and Connect Database

 In this tutorial, we will guide you on installing DBT in a virtual environment on Windows. We will also cover setting up a project and demonstrate how to connect to MySQL using DBT. Furthermore, we will explore sample projects that involve loading data into a MySQL database using DBT.


To install dbt on a Windows and set up your first dbt project, please folow to the following steps

 

Step 1:

    Open Visual Studio and go to the Extensions menu. Search for "dbt power user" and click on "Install".

 


Step 2:

   Create a project folder where you want to set up dbt. For example, create a folder called "dbt" in the G drive:

G:\dbt

 

Step 3:

            Create a .dbt folder under the C drive. For example, create a folder called ".dbt" under

 C:\Users\SRINIVASULU\.dbt

 

Step 4:

            Open the project folder using Visual Studio.

Step 5:

            Create a Python virtual environment using the following command:

 python -m venv dbt_venv

 

Step 6:

            Activate the created virtual environment using the following command: .\dbt_venv\Scripts\Activate.ps1

 

Step 7:

Install the necessary database package. In this case, for MySQL, use the following command:

python -m pip install dbt-mysql

Step 8:

Initialize the project to set up the database using the command:

            dbt init

Step 9:

Once the previous step is completed, open the profiles.yml file located at

            C:\Users\SRINIVASULU\.dbt

 

Here I am giving my project connection details. Pls update as per your database connection details.

 

type: mysql

server: localhost

port: 3306

database: mysql # optional, should be same as schema

schema: analytics

username: sreenu

password: tiger

driver: MySQL ODBC 8.0 ANSI Driver

 

Step 10:

Test your connection: Verify your database connection by running the following command:

 

            dbt debug

 

dbt run




 

This command will test the connection and provide feedback on whether the setup is successful.

 

You have now successfully installed dbt on your Windows system and set up your first dbt project. You can proceed to develop and execute SQL transformations using dbt for your data modelling needs.

 

Youtube video link
https://youtu.be/gZO44wtP5O4



Post a Comment

0 Comments