Skip to content

Instantly share code, notes, and snippets.

View phillipsj's full-sized avatar

Jamie Phillips phillipsj

View GitHub Profile
@phillipsj
phillipsj / Dockerfile
Created September 22, 2020 00:25
FROM line for SQL Server
# Adventure Works Database on SQL Server 2019
FROM mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04
@phillipsj
phillipsj / build-docker.sh
Created September 22, 2020 00:25
Bash build command
$ 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"]
@phillipsj
phillipsj / docker-run.sh
Created September 22, 2020 00:27
Docker run command for Adventure Works database
$ docker run -p 1633:1433 --name adventureworks2019 -h adventureworks2019 -d adventureworks:2019
e07d0406ca31eda958c9ed2a830bf83fea3c9d15ba2c43870410766a40a112d6
@phillipsj
phillipsj / docker-list.sh
Last active September 22, 2020 00:29
Docker command to list Adventure Works container
$ 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
@phillipsj
phillipsj / dashtutorial.sh
Created October 13, 2020 15:50
pip install --user pandas pyodbc dash sqlalchemy
$ pip install --user pandas pyodbc dash sqlalchemy
Successfully installed Flask-1.1.2 .......
@phillipsj
phillipsj / app.py
Created October 13, 2020 15:52
Dash Tutorial Imports
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
@phillipsj
phillipsj / app.py
Created October 13, 2020 15:53
Creating dash application.
app = dash.Dash(__name__)
@phillipsj
phillipsj / app.py
Created October 13, 2020 15:53
Create SQL Alchemy Engine
engine = create_engine(
"mssql+pyodbc://sa:ThisIsAReallyCoolPassword123@localhost:1633/AdventureWorks2019?driver=ODBC+Driver+17+for+SQL+Server")
@phillipsj
phillipsj / app.py
Last active October 13, 2020 15:54
Dash tutorial query
query = '''
SELECT CONCAT([FirstName],' ', [LastName]) as FullName,
[SalesQuota],
[SalesYTD]
FROM [Sales].[vSalesPerson]
'''
@phillipsj
phillipsj / app.py
Created October 13, 2020 15:55
Create Pandas Dataframe for Dash tutorial
df = pd.read_sql(query, engine)