This file contains 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 | |
# Note: This isn't a secure password, and please don't use this for production. | |
ENV SA_PASSWORD=ThisIsAReallyCoolPassword123 | |
ENV ACCEPT_EULA=Y | |
# Setting the user | |
USER mssql |
This file contains 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
$ python app.py | |
Dash is running on http://127.0.0.1:8050/ | |
* Serving Flask app "app" (lazy loading) | |
* Environment: production | |
WARNING: This is a development server. Do not use it in a production deployment. | |
Use a production WSGI server instead. | |
* Debug mode: on |
This file contains 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 | |
app = dash.Dash(__name__) | |
engine = create_engine( |
This file contains 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
if __name__ == '__main__': | |
app.run_server(debug=True) |
This file contains 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.layout = html.Div(children=[ | |
html.H1(children='Adventure Works Sales Report'), | |
html.Div(children=''' | |
YTD Sales by Individual. | |
'''), | |
dcc.Graph( | |
id='sales-graph', | |
figure=salesFigure |
This file contains 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
salesFigure = px.bar(df, x="Name", y="SalesYTD", color="Name", barmode="group") | |
quotaFigure = px.bar(df, x="Name", y="SalesQuota", color="Name", barmode="group") |
This file contains 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) |
This file contains 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 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 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__) |