How to get “Microsoft Contoso BI Demo Dataset for Retail Industry” into Macbook with M1/Apple Chip
Now that you're here, it's quite obvious that you're looking for a solution.
In the end, I would like to tell you what wouldn’t work (or at least didn’t work for me as of ‘Thu Sep 16, 2021, 11:57:38 GMT-0700 (Pacific Daylight Time)’.
There are 4 Prerequisites and one small process to achieve this.
- Docker
- Azure Data Studio
- Unarchiver
- Contoso Demo Dataset for Retail Industry
1. Docker
Why Docker?
MSSQL would require a windows environment and since we are on the Mac platform we need a solution to provide us with a Windows OS environment. Note: There are other solutions apart from Docker, but I find this to be the fastest and the easiest
How to download Docker?
Download it from the official site here: Docker Desktop
2. Azure Data Studio
Why Azure Data Studio?
Azure Data Studio provides us an easy interface to interact with the underneath MSSQL environment to import our Contoso dataset into MSSQL
How to download Docker?
Download it from the official Microsoft website: here
3. Unarchiver
Why Unarchiver?
As the Dataset we get to download is in .exe format and the default MacBook’archive utility app couldn’t extract the files from the .exe file.
How to download?
Download it from the official Unarchiver website: here
4. Contoso Demo Dataset for Retail Industry
How to download?
- Go to the link https://www.microsoft.com/en-us/download/details.aspx?id=18279 and click download
2. Select the Backup file i.e ContosoBIdemoBAK.exe and click Next to download
The Final Process;
Now that you have acquired all the prerequisites above 4, there are only a few steps that need to be done as part of the final process
Step 1: Download Azure SQL Edge Docker Image: link
Open the terminal and run the following command, this will download the docker image to your machine.
docker pull mcr.microsoft.com/azure-sql-edge
Step 2: Create and Run the Azure SQL Edge Docker Image:
The below command will create a
- Container named mssql
- User named sa
- Password MyP@ssWord
docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=MyP@ssWord" -e "MSSQL_PID=Developer" -e "MSSQL_USER=SA" -p 1433:1433 -d --name=mssql mcr.microsoft.com/azure-sql-edge
Step 4: Extract Contoso Dataset
Use an Unarchiver to extract the ContosoBIdemoBAK.exe file
Step 5: Copy the Contoso Dataset into the Docker Container
docker cp ./path_to_the_extracted_data_set container_id:/var/opt/mssql/data/
Now here you require container id, here’s how you can find it
The below command gives the short container id
docker ps
The below command gives the full container id
$ docker inspect -f '{{.Id}}' SHORT_CONTAINER_ID
Step 6: Connect Azure Data Studio to the MSSQL Server
Open Azure Data Studio > Click on New Connection
In the Connection Details
Server: 127.0.0.1
Authentication type: Sql Login
Username: sa
Password: MyP@ssWord
Step 7: Import the Dataset
- Click on Restore
- Choose Backup file
- Directly enter the path below
/var/opt/mssql/data/ContosoBIdemoBAK/ContosoRetailDW.bak
OR
- Choose the “…” to choose the .bak file
- Click restore
In the end, you should see the Restored Dataset something like this
I would like to tell you what wouldn't work (or at least didn't work for me as of ‘Thu Sep 16, 2021, 11:57:38 GMT-0700 (Pacific Daylight Time)’.
Getting the MSSQL Server image from the Docker Hub: link
This doesn't work because the Docker image here is not compatible with the Mac M1/Silicon Chip