How should you get started with Azure Data API Builder ?

Abhijith Ganesh
2 min readNov 15, 2023

--

How did I even find DAB ?

So, I was attending an in-person event in my city (Chennai, IN) and I came across Sajeetharan who’s a PM for Azure Cosmos ! This was the first time I saw what Azure Data API Builder is, I realized how powerful this open-source tool is. So let us see how to get started with it !

Prerequisites

Now, you either need docker or .NET 6. to follow with this blog, so do install which ever is better suited.

Part 1: The installation

.NET way:

dotnet tool install -g Microsoft.DataApiBuilder

Docker way:

services:
data_api_builder:
depends_on:
- database
image: mcr.microsoft.com/azure-databases/data-api-builder:latest
container_name: azure-dab-data-api-builder
volumes:
- ./config/dab-config.Postgresql.json:/App/dab-config.json
ports:
- 5000:5000

This container or your PC will have the required utility !

There is an additional configuration for the container which we will see in part 2

Part 2: Configuration

We have the DAB utility installed, now we have to configure the pre-existing tables/entities (if you’re using Azure Cosmos😉)

Initialization

dab init --database-type <your-database-type> --connection-string=""

Key things that you need to replace:

  • Your database type: Currently the tool supports MySQL, PostgreSQL, Microsoft server and Azure cosmos
  • Connection String: The string which contains the database URI

This configuration was saved as dab-config.Postgresql.json in part 1.

Part 3: Adding Entities

dab add Stock --config <your file name> --source stocks --permissions "anonymous:create,read,update,delete"

Key things that you need to replace:

  • Your configuration name
  • Your permissions for the entities

Once you’ve done with these three steps, you’re good to launch 🚀

GraphQL endpoint

Sample of the query working

Once you’ve set everything up, you can go to http://localhost:5000/graphql and test out your queries.

Concluding Remarks

The product has still not been released and I am eagerly waiting for its release. I am also making Blogstra (A full stack blog app that runs on top of data api builder)

Also, feel free to checkout my talk with Sajeetharan here:

--

--

Abhijith Ganesh
Abhijith Ganesh

No responses yet