Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
atrakic committed Dec 14, 2024
1 parent f112fde commit 99bd7e3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
]
}
}
}
}
3 changes: 1 addition & 2 deletions DbProject/dbo/Tables/DimCustomer.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ CREATE TABLE [dbo].[DimCustomer]
[LastName] VARCHAR (50) NOT NULL,
[AddressLine1] VARCHAR (200) NOT NULL,
[City] VARCHAR (50) NOT NULL,
[PostalCode] VARCHAR (20) NOT NULL,
[SurrogateKey] INT NOT NULL
[PostalCode] VARCHAR (20) NOT NULL
);
GO

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ build:
dotnet outdated --upgrade
dotnet build

test:
#dotnet test
./tests/test.sh

clean:
dotnet clean
docker compose down --remove-orphans --volumes
4 changes: 2 additions & 2 deletions SQL/dw-seed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
MERGE INTO DimCustomer AS target
USING (VALUES
(1, 'John', 'Doe', '123 Main St', 'Springfield', '12345'),
(2, 'Jane', 'Smith', '456 Elm St', 'Springfield', '12345'),
(3, 'Bob', 'Jones', '789 Oak St', 'Springfield', '12345')
(2, 'Jane', 'Doe', '456 Elm St', 'Springfield', '12345'),
(3, 'Alice', 'Smith', '789 Oak St', 'Springfield', '12345')
) AS source (CustomerKey, FirstName, LastName, AddressLine1, City, PostalCode)
ON target.CustomerKey = source.CustomerKey
WHEN NOT MATCHED BY TARGET THEN
Expand Down
11 changes: 6 additions & 5 deletions tests/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

# select all tables and views from sql server:
set -e

QUERY="
SELECT * FROM INFORMATION_SCHEMA.TABLES
"
DB="demo"
QUERY="SELECT * FROM vSalesByCityAndCategory"

docker exec -it --env-file .env db /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -Q "$QUERY" -b
docker exec -it --env-file .env db /opt/mssql-tools/bin/sqlcmd \
-S localhost -U sa -P "$MSSQL_SA_PASSWORD" -d "$DB" -Q "$QUERY" -b

0 comments on commit 99bd7e3

Please sign in to comment.