This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adventure Works Database on SQL Server 2019 | |
FROM mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker build -t adventureworks:2019 | |
Sending build context to Docker daemon 334.3MB | |
Step 1/9 : FROM mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04 | |
---Removed--- | |
Processed 26344 pages for database 'AdventureWorks2019', file 'AdventureWorks2017' on file 1. | |
Processed 2 pages for database 'AdventureWorks2019', file 'AdventureWorks2017_log' on file 1. | |
RESTORE DATABASE successfully processed 26346 pages in 0.891 seconds (231.003 MB/sec). | |
Removing intermediate container 3cf414b336c4 | |
---> 7420ec09d77c | |
Step 9/9 : CMD ["/opt/mssql/bin/sqlservr"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker run -p 1633:1433 --name adventureworks2019 -h adventureworks2019 -d adventureworks:2019 | |
e07d0406ca31eda958c9ed2a830bf83fea3c9d15ba2c43870410766a40a112d6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docker container list | |
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |
e07d0406ca31 adventureworks:2019 "/opt/mssql/bin/perm…" 46 seconds ago Up 44 seconds 0.0.0.0:1633->1433/tcp adventureworks2019 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ pip install --user pandas pyodbc dash sqlalchemy | |
Successfully installed Flask-1.1.2 ....... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dash | |
import dash_core_components as dcc | |
import dash_html_components as html | |
import plotly.express as px | |
import pandas as pd | |
from sqlalchemy import create_engine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = dash.Dash(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
engine = create_engine( | |
"mssql+pyodbc://sa:ThisIsAReallyCoolPassword123@localhost:1633/AdventureWorks2019?driver=ODBC+Driver+17+for+SQL+Server") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query = ''' | |
SELECT CONCAT([FirstName],' ', [LastName]) as FullName, | |
[SalesQuota], | |
[SalesYTD] | |
FROM [Sales].[vSalesPerson] | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = pd.read_sql(query, engine) |