SlideShare uma empresa Scribd logo
1 de 50
Supercharging
SQL Users
with Jupyter notebooks
noteable
@noteable_io
@michelleufford
Michelle Ufford
2
Unbreakable Kimmy Schmidt
3https://insights.stackoverflow.com/survey/2020#technology-programming-scripting-and-markup-languages-professional-developers
Stack Overflow’s 2020 Developer Survey
noteable
Challenges SQL users face
4
● Connecting
● Security
● Scheduling
Here be dragons
3-Tier Action Plan
5
1 Foundation
Lay a strong foundation with
JupyterHub, SQL Magics, &
popular libraries & extensions.
noteable
6
1.1
JupyterHub
(or integrate with your own hosted computing environment)
noteable
spawns
7
1.1 JupyterHub
auth
noteable
8
1.2
SQL Magics
(it’s quite magical!)
noteable
9
1.2 Connecting without SQL Magics
import prestodb.dbapi as presto
import prestodb
conn = presto.Connection(
host='host.us-east-1',
port=1433,
user='mufford',
http_scheme='https',
auth=prestodb.auth.BasicAuthentication(username, password))
cur = conn.cursor()
cur.execute('SELECT * FROM orders LIMIT 10;')
result = cur.fetchall()
df = pd.DataFrame(sorted(result, key=lambda x: x[2], reverse=True))
display(df)
noteable
10
1.2 Connecting with sqlalchemy
import pandas as pd
from sqlalchemy.engine import create_engine
engine = create_engine('mssql+pymssql://username:' +
‘PASSWORD@host.us-east-1/dw/public' +
'?warehouse=proddw&role=dw_read')
pd.read_sql('SELECT * FROM orders LIMIT 10;', engine)
noteable
11
1.2 Connecting with SQL Magics
!pip install ipython-sql
%load_ext sql
%sql mssql+pymssql://username:PASSWORD@host.us-east-1/
dw/public?warehouse=proddw&role=dw_read
%sql SELECT * FROM orders LIMIT 10;
noteable
1.3
Libraries
(the easiest way to become a hero)
12
noteable
13
1.3 Popular Libraries
Popular libraries to consider pre-installing for your SQL users
● ipython-sql
● SQLAlchemy
● Pandas
● Matplotlib
● Scrapy
● BeautifulSoup
noteable
← Add libraries to your Docker image
14
15
1.3 SQL Magics with ipython-sql installed
%load_ext sql
%sql mssql+pymssql://username:PASSWORD@host.us-east-1/
dw/public?warehouse=proddw&role=dw_read
%sql SELECT * FROM orders LIMIT 10;
noteable
16
1.4
Extensions
(Excite your users with expedient extensions)
noteable
1.4 Useful Extensions
jupyterlab-sql
extension
noteable
3-Tier Action Plan
18
1
2
Foundation
Lay a strong foundation with
JupyterHub, SQL Magics, &
popular libraries & extensions.
Integration
Bring everything together
in a secure & tightly
integrated environment
noteable
19
2.1
JupyterHub
+ Secure Connections
(because no one wants to end up a cautionary tale)
noteable
Enterprise
Gateway
20
2.1 JupyterHub + Enterprise Gateway
auth
Community Images
Notebook Container Kernel ContainerNotebook UI
noteable
21
2.2
Environment Variables
(a few simple settings can have a huge impact!)
noteable
22
2.2 Environment Variables in JupyterHub
--config.yaml--
hub:
extraEnv:
DW_PROD = mssql+pymssql://{user}:{password}@host
.us-east-1/dw/public?warehouse=proddw&role=dw_read
noteable
23
2.2 Environment Variables + SQL Magics
%load_ext sql
%sql DW_PROD
%sql SELECT * FROM orders LIMIT 10;
noteable
24
2.2 More fun with Environment Variables
Useful environment variables to consider:
● Database connections
● Secrets
● APIs
● Cluster resources
● Serialization config
noteable
25
2.3
Templates
(simple yet surprisingly powerful)
noteable
26
2.3 Templates with Papermill
noteable
27
2.3 Templatize with Papermill
noteable
28
2.3 Automate with Papermill
noteable
29
2.3 More ideas for templatized notebooks
Some of the ways companies are leveraging Jupyter templates:
● Workflow orchestration
● Post-deployment validation
● Integration layer
● Environment configuration
● Training materials
noteable
3
1
2
3-Tier Action Plan
30
Foundation
Lay a strong foundation with
JupyterHub, SQL Magics, &
popular libraries & extensions.
Customization
Take convenience to the next level
with custom magics & extensions
Integration
Bring everything together
in a secure & tightly
integrated environment
noteable
31
3.1
Custom SQL Magics
(make your own magic!)
noteable
%sql
%snowflake
%presto --cluster=adhoc
%sparksql --cluster=prod memory=16GB
32
3.1 Custom SQL Magics
noteable
33
3.1 Custom SQL Magic - List Tables
from IPython.core.magic import line_magic
@magics_class
class CustomListTableMagics(Magics):
@line_magic
def tables(self, line):
stmt = 'select * from sys.tables;'
return pd.read_sql(stmt, engine)
ip = get_ipython()
ip.register_magics(CustomListTableMagics)
noteable
34
3.1 Custom SQL Magic - List Tables
noteable
35
3.1 Custom SQL Magic - Sample Rows
from IPython.core.magic import line_magic
@magics_class
class CustomSampleRows(Magics):
@line_magic
def tables(self, line):
stmt = 'select * from {} where partition_date = today()
order by rand() limit 10;'
return pd.read_sql(stmt.format(line), engine)
ip = get_ipython()
ip.register_magics(CustomSampleRows)
noteable
36
3.2
Custom UI
(99 UI problems but customizing makes it 100)
noteable
37
3.2 Custom UI Components
noteable
38
3.2 Custom UI Components
Useful component libraries to get you started:
● nteract
● BlueprintJS
● … or write your own :)
noteable
39
3.3 Other ideas for customization
Depending on your environment & users, you might consider:
● custom kernels
● advanced magics
● complex extensions
● deep integrations
● autocomplete & linting
noteable
Join the Noteable Insiders
Become a Noteable Insider at noteable.io/insider-program
Michelle Ufford
CEO
Elijah Meeks
Chief Visualization Officer
Matthew Seal
Chief Technology Officer
Carol Willing
Lead Technical Evangelist
Help us create a better SQL experience! 🙂
Meet the Noteable team
noteableSlides available at noteable.io/jupytercon
1.1 Resources
41
1.1 Set up JupyterHub (or a similar multi-user hosted environment)
● JupyterHub
● JupyterHub docs
● The Littlest JupyterHub
● Zero to JupyterHub with Kubernetes
● JupyterLab and JupyterHub - Perfect Together | Carol Willing @ PyBay2018
● Configuring user environments — JupyterHub 1.1.0 documentation
noteable
1.2 Resources
42
1.2 Add support for SQL Magics to your base Docker image
● ipython-sql
● SQL Magic with ipython-sql
● Jupyter Magics with SQL
● Make Jupyter/IPython Notebook even more magical with cell magic extensions!
● SQL Interface within JupyterLab
noteable
1.3 Resources
43
1.3 - Pre-install popular libraries in your Jupyter environment
● Jupyter Docker Stacks
● JupyterHub - Configuring user environments
● ipython-sql
● SQLAlchemy
● Awesome Python’s Curated List of Awesome Frameworks
● Python Library: The 21 Best Libraries for Python Programmers
noteable
1.4 Resources
44
1.4 - Install useful extensions for your users
● JupyterLab-SQL
● The Littlest JupyterHub - Enabling Jupyter Notebook extensions
● Adding Jupyter Notebook Extensions to a Docker Image
● Distributing Jupyter Extensions as Python Packages
● Unofficial Jupyter Notebook Extensions
● jupyterlab-extension public repos on GitHub
● The Top 47 Jupyterlab Extension Open Source Projects
● PyData Austin 2019: Customizing JupyterLab using extensions
noteable
2.1 Resources
45
2.1 Secure connections in your JupyterHub with Enterprise Gateway
● Jupyter Enterprise Gateway on GitHub
● Jupyter Enterprise Gateway
● Jupyter Enterprise Gateway - Security Features
● Strata - Scaling Jupyter with Jupyter Enterprise Gateway
● Building analytical microservices powered by Jupyter Kernels - Luciano Resende & Kevin Bates
noteable
2.2 Resources
46
2.2 Simplify life with simple environment variables
● Zero to JupyterHub - Set Environment Variables
● How to Use Jupyter Notebooks with Apache Spark - Setting Jupyter env variables
● Example - jupyter / docker-stacks / pyspark-notebook on GitHub
● Configuring user environments — JupyterHub 1.1.0 documentation
noteable
2.3 Resources
47
2.3 Automate workflows & integrate systems using Papermill templates
● Papermill on GitHub
● Papermill docs
● Beyond Interactive: Notebook Innovation at Netflix
● Beyond Interactive, Part 2: Scheduling Notebooks at Netflix
● Introduction to Papermill
● Data Council - Notebooks as Functions with Papermill | Netflix
● Reusable Execution in Production Using Papermill (Google Cloud AI Huddle)
noteable
3.1 Resources
48
3.1 Create a magical experience for SQL users with custom SQL Magics
● Creating Custom Magic Commands in Jupyter
● Creating an IPython extension with custom magic commands
● SparkMagic
● Presto Magic
noteable
3.2 Resources
49
3.2 Take convenience to the next level with custom UI components
● nteract
● nteract on GitHub
● nteract component docs
● BlueprintJS
● Using JupyterLab components
● A very simple demo of interactive controls on Jupyter notebook
noteable
3.3 Resources
50
3.3 Create a custom Jupyter experience tailored to your company/organization
● JupyterLab - Common Extension Points
● JupyterLab Extension Developer Guide
● How to Write a Jupyter Notebook Extension
● Example IPython magic functions for Pyspark
● Making kernels for Jupyter
noteable

Mais conteúdo relacionado

Mais procurados

CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...
CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...
CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...
Databricks
 
Jim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
Jim Dowling – Interactive Flink analytics with HopsWorks and ZeppelinJim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
Jim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
Flink Forward
 

Mais procurados (20)

CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...
CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...
CERN’s Next Generation Data Analysis Platform with Apache Spark with Enric Te...
 
Stream All Things—Patterns of Modern Data Integration with Gwen Shapira
Stream All Things—Patterns of Modern Data Integration with Gwen ShapiraStream All Things—Patterns of Modern Data Integration with Gwen Shapira
Stream All Things—Patterns of Modern Data Integration with Gwen Shapira
 
The Past, Present, and Future of Hadoop at LinkedIn
The Past, Present, and Future of Hadoop at LinkedInThe Past, Present, and Future of Hadoop at LinkedIn
The Past, Present, and Future of Hadoop at LinkedIn
 
Big Telco - Yousun Jeong
Big Telco - Yousun JeongBig Telco - Yousun Jeong
Big Telco - Yousun Jeong
 
Treasure Data and Fluentd
Treasure Data and FluentdTreasure Data and Fluentd
Treasure Data and Fluentd
 
Real-time analytics with Druid at Appsflyer
Real-time analytics with Druid at AppsflyerReal-time analytics with Druid at Appsflyer
Real-time analytics with Druid at Appsflyer
 
Provisioning Datadog with Terraform
Provisioning Datadog with TerraformProvisioning Datadog with Terraform
Provisioning Datadog with Terraform
 
Data Science at Scale by Sarah Guido
Data Science at Scale by Sarah GuidoData Science at Scale by Sarah Guido
Data Science at Scale by Sarah Guido
 
Big data serving: Processing and inference at scale in real time
Big data serving: Processing and inference at scale in real timeBig data serving: Processing and inference at scale in real time
Big data serving: Processing and inference at scale in real time
 
Implementing the Lambda Architecture efficiently with Apache Spark
Implementing the Lambda Architecture efficiently with Apache SparkImplementing the Lambda Architecture efficiently with Apache Spark
Implementing the Lambda Architecture efficiently with Apache Spark
 
How to Boost 100x Performance for Real World Application with Apache Spark-(G...
How to Boost 100x Performance for Real World Application with Apache Spark-(G...How to Boost 100x Performance for Real World Application with Apache Spark-(G...
How to Boost 100x Performance for Real World Application with Apache Spark-(G...
 
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Scalable Monitoring Using Apache Spark and Friends with Utkarsh BhatnagarScalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
 
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
Behavior-Driven Development (BDD) Testing with Apache Spark with Aaron Colcor...
 
More Data, More Problems: Scaling Kafka-Mirroring Pipelines at LinkedIn
More Data, More Problems: Scaling Kafka-Mirroring Pipelines at LinkedIn More Data, More Problems: Scaling Kafka-Mirroring Pipelines at LinkedIn
More Data, More Problems: Scaling Kafka-Mirroring Pipelines at LinkedIn
 
Jim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
Jim Dowling – Interactive Flink analytics with HopsWorks and ZeppelinJim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
Jim Dowling – Interactive Flink analytics with HopsWorks and Zeppelin
 
From R Script to Production Using rsparkling with Navdeep Gill
From R Script to Production Using rsparkling with Navdeep GillFrom R Script to Production Using rsparkling with Navdeep Gill
From R Script to Production Using rsparkling with Navdeep Gill
 
Top 5 mistakes when writing Streaming applications
Top 5 mistakes when writing Streaming applicationsTop 5 mistakes when writing Streaming applications
Top 5 mistakes when writing Streaming applications
 
Dynamic DDL: Adding Structure to Streaming Data on the Fly with David Winters...
Dynamic DDL: Adding Structure to Streaming Data on the Fly with David Winters...Dynamic DDL: Adding Structure to Streaming Data on the Fly with David Winters...
Dynamic DDL: Adding Structure to Streaming Data on the Fly with David Winters...
 
Developing high frequency indicators using real time tick data on apache supe...
Developing high frequency indicators using real time tick data on apache supe...Developing high frequency indicators using real time tick data on apache supe...
Developing high frequency indicators using real time tick data on apache supe...
 
Dr. Elephant: Achieving Quicker, Easier, and Cost-Effective Big Data Analytic...
Dr. Elephant: Achieving Quicker, Easier, and Cost-Effective Big Data Analytic...Dr. Elephant: Achieving Quicker, Easier, and Cost-Effective Big Data Analytic...
Dr. Elephant: Achieving Quicker, Easier, and Cost-Effective Big Data Analytic...
 

Semelhante a JupyterCon 2020 - Supercharging SQL Users with Jupyter Notebooks

Automation for the Modern Enterprise_26oct2017
Automation for the Modern Enterprise_26oct2017Automation for the Modern Enterprise_26oct2017
Automation for the Modern Enterprise_26oct2017
Claire Priester Papas
 

Semelhante a JupyterCon 2020 - Supercharging SQL Users with Jupyter Notebooks (20)

Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
Puppet Camp Silicon Valley 2015: How TubeMogul reached 10,000 Puppet Deployme...
 
devops@cineca
devops@cinecadevops@cineca
devops@cineca
 
Day 13 - Creating Data Processing Services | Train the Trainers Program
Day 13 - Creating Data Processing Services | Train the Trainers ProgramDay 13 - Creating Data Processing Services | Train the Trainers Program
Day 13 - Creating Data Processing Services | Train the Trainers Program
 
Improving Operations Efficiency with Puppet
Improving Operations Efficiency with PuppetImproving Operations Efficiency with Puppet
Improving Operations Efficiency with Puppet
 
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOpsDevOps Days Boston 2017: Real-world Kubernetes for DevOps
DevOps Days Boston 2017: Real-world Kubernetes for DevOps
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
 
How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014How to Puppetize Google Cloud Platform - PuppetConf 2014
How to Puppetize Google Cloud Platform - PuppetConf 2014
 
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
Velocity NYC 2017: Building Resilient Microservices with Kubernetes, Docker, ...
 
Leveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioningLeveraging docker for hadoop build automation and big data stack provisioning
Leveraging docker for hadoop build automation and big data stack provisioning
 
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioningLeveraging Docker for Hadoop build automation and Big Data stack provisioning
Leveraging Docker for Hadoop build automation and Big Data stack provisioning
 
Automation for the Modern Enterprise_26oct2017
Automation for the Modern Enterprise_26oct2017Automation for the Modern Enterprise_26oct2017
Automation for the Modern Enterprise_26oct2017
 
Session 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers ProgramSession 8 - Creating Data Processing Services | Train the Trainers Program
Session 8 - Creating Data Processing Services | Train the Trainers Program
 
Puppet overview
Puppet overviewPuppet overview
Puppet overview
 
SQL in Version Control using SQL Server Database Projects
SQL in Version Control using SQL Server Database ProjectsSQL in Version Control using SQL Server Database Projects
SQL in Version Control using SQL Server Database Projects
 
GWT Introduction and Overview - SV Code Camp 09
GWT Introduction and Overview - SV Code Camp 09GWT Introduction and Overview - SV Code Camp 09
GWT Introduction and Overview - SV Code Camp 09
 
Accelerate your Journey to Pervasive Automation 05.03.2018
Accelerate your Journey to Pervasive Automation 05.03.2018Accelerate your Journey to Pervasive Automation 05.03.2018
Accelerate your Journey to Pervasive Automation 05.03.2018
 
Continuous Integration & Continuous Delivery
Continuous Integration & Continuous DeliveryContinuous Integration & Continuous Delivery
Continuous Integration & Continuous Delivery
 
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
O'Reilly Software Architecture Conference London 2017: Building Resilient Mic...
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
2018 02 20-jeg_index
2018 02 20-jeg_index2018 02 20-jeg_index
2018 02 20-jeg_index
 

Mais de Michelle Ufford

Mais de Michelle Ufford (6)

Data Science at Netflix - Principles for Speed & Scale [Rev 2019 keynote]
Data Science at Netflix - Principles for Speed & Scale [Rev 2019 keynote]Data Science at Netflix - Principles for Speed & Scale [Rev 2019 keynote]
Data Science at Netflix - Principles for Speed & Scale [Rev 2019 keynote]
 
Notebooks @ Netflix: From analytics to engineering with Jupyter notebooks
Notebooks @ Netflix: From analytics to engineering with Jupyter notebooksNotebooks @ Netflix: From analytics to engineering with Jupyter notebooks
Notebooks @ Netflix: From analytics to engineering with Jupyter notebooks
 
Data Engineering Efficiency @ Netflix - Strata 2017
Data Engineering Efficiency @ Netflix - Strata 2017Data Engineering Efficiency @ Netflix - Strata 2017
Data Engineering Efficiency @ Netflix - Strata 2017
 
Scaling Data Quality @ Netflix
Scaling Data Quality @ NetflixScaling Data Quality @ Netflix
Scaling Data Quality @ Netflix
 
Data Warehousing Patterns for Hadoop
Data Warehousing Patterns for HadoopData Warehousing Patterns for Hadoop
Data Warehousing Patterns for Hadoop
 
Data-Driven @ Netflix
Data-Driven @ NetflixData-Driven @ Netflix
Data-Driven @ Netflix
 

Último

Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
amitlee9823
 
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
amitlee9823
 
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
gajnagarg
 
Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...
gajnagarg
 
Call Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
amitlee9823
 
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
gajnagarg
 
Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...
gajnagarg
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
amitlee9823
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
gajnagarg
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
amitlee9823
 

Último (20)

Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night StandCall Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Attibele ☎ 7737669865 🥵 Book Your One night Stand
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men  🔝Dindigul🔝   Escor...
➥🔝 7737669865 🔝▻ Dindigul Call-girls in Women Seeking Men 🔝Dindigul🔝 Escor...
 
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls roorkee Escorts ☎️9352988975 Two shot with one girl ...
 
Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls kakinada Escorts ☎️9352988975 Two shot with one girl...
 
Call Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night StandCall Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Shivaji Nagar ☎ 7737669865 🥵 Book Your One night Stand
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
Just Call Vip call girls Mysore Escorts ☎️9352988975 Two shot with one girl (...
 
Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...
Just Call Vip call girls Bellary Escorts ☎️9352988975 Two shot with one girl ...
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
Just Call Vip call girls Palakkad Escorts ☎️9352988975 Two shot with one girl...
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 

JupyterCon 2020 - Supercharging SQL Users with Jupyter Notebooks

  • 1. Supercharging SQL Users with Jupyter notebooks noteable @noteable_io @michelleufford Michelle Ufford
  • 4. Challenges SQL users face 4 ● Connecting ● Security ● Scheduling Here be dragons
  • 5. 3-Tier Action Plan 5 1 Foundation Lay a strong foundation with JupyterHub, SQL Magics, & popular libraries & extensions. noteable
  • 6. 6 1.1 JupyterHub (or integrate with your own hosted computing environment) noteable
  • 8. 8 1.2 SQL Magics (it’s quite magical!) noteable
  • 9. 9 1.2 Connecting without SQL Magics import prestodb.dbapi as presto import prestodb conn = presto.Connection( host='host.us-east-1', port=1433, user='mufford', http_scheme='https', auth=prestodb.auth.BasicAuthentication(username, password)) cur = conn.cursor() cur.execute('SELECT * FROM orders LIMIT 10;') result = cur.fetchall() df = pd.DataFrame(sorted(result, key=lambda x: x[2], reverse=True)) display(df) noteable
  • 10. 10 1.2 Connecting with sqlalchemy import pandas as pd from sqlalchemy.engine import create_engine engine = create_engine('mssql+pymssql://username:' + ‘PASSWORD@host.us-east-1/dw/public' + '?warehouse=proddw&role=dw_read') pd.read_sql('SELECT * FROM orders LIMIT 10;', engine) noteable
  • 11. 11 1.2 Connecting with SQL Magics !pip install ipython-sql %load_ext sql %sql mssql+pymssql://username:PASSWORD@host.us-east-1/ dw/public?warehouse=proddw&role=dw_read %sql SELECT * FROM orders LIMIT 10; noteable
  • 12. 1.3 Libraries (the easiest way to become a hero) 12 noteable
  • 13. 13 1.3 Popular Libraries Popular libraries to consider pre-installing for your SQL users ● ipython-sql ● SQLAlchemy ● Pandas ● Matplotlib ● Scrapy ● BeautifulSoup noteable
  • 14. ← Add libraries to your Docker image 14
  • 15. 15 1.3 SQL Magics with ipython-sql installed %load_ext sql %sql mssql+pymssql://username:PASSWORD@host.us-east-1/ dw/public?warehouse=proddw&role=dw_read %sql SELECT * FROM orders LIMIT 10; noteable
  • 16. 16 1.4 Extensions (Excite your users with expedient extensions) noteable
  • 18. 3-Tier Action Plan 18 1 2 Foundation Lay a strong foundation with JupyterHub, SQL Magics, & popular libraries & extensions. Integration Bring everything together in a secure & tightly integrated environment noteable
  • 19. 19 2.1 JupyterHub + Secure Connections (because no one wants to end up a cautionary tale) noteable
  • 20. Enterprise Gateway 20 2.1 JupyterHub + Enterprise Gateway auth Community Images Notebook Container Kernel ContainerNotebook UI noteable
  • 21. 21 2.2 Environment Variables (a few simple settings can have a huge impact!) noteable
  • 22. 22 2.2 Environment Variables in JupyterHub --config.yaml-- hub: extraEnv: DW_PROD = mssql+pymssql://{user}:{password}@host .us-east-1/dw/public?warehouse=proddw&role=dw_read noteable
  • 23. 23 2.2 Environment Variables + SQL Magics %load_ext sql %sql DW_PROD %sql SELECT * FROM orders LIMIT 10; noteable
  • 24. 24 2.2 More fun with Environment Variables Useful environment variables to consider: ● Database connections ● Secrets ● APIs ● Cluster resources ● Serialization config noteable
  • 26. 26 2.3 Templates with Papermill noteable
  • 27. 27 2.3 Templatize with Papermill noteable
  • 28. 28 2.3 Automate with Papermill noteable
  • 29. 29 2.3 More ideas for templatized notebooks Some of the ways companies are leveraging Jupyter templates: ● Workflow orchestration ● Post-deployment validation ● Integration layer ● Environment configuration ● Training materials noteable
  • 30. 3 1 2 3-Tier Action Plan 30 Foundation Lay a strong foundation with JupyterHub, SQL Magics, & popular libraries & extensions. Customization Take convenience to the next level with custom magics & extensions Integration Bring everything together in a secure & tightly integrated environment noteable
  • 31. 31 3.1 Custom SQL Magics (make your own magic!) noteable
  • 32. %sql %snowflake %presto --cluster=adhoc %sparksql --cluster=prod memory=16GB 32 3.1 Custom SQL Magics noteable
  • 33. 33 3.1 Custom SQL Magic - List Tables from IPython.core.magic import line_magic @magics_class class CustomListTableMagics(Magics): @line_magic def tables(self, line): stmt = 'select * from sys.tables;' return pd.read_sql(stmt, engine) ip = get_ipython() ip.register_magics(CustomListTableMagics) noteable
  • 34. 34 3.1 Custom SQL Magic - List Tables noteable
  • 35. 35 3.1 Custom SQL Magic - Sample Rows from IPython.core.magic import line_magic @magics_class class CustomSampleRows(Magics): @line_magic def tables(self, line): stmt = 'select * from {} where partition_date = today() order by rand() limit 10;' return pd.read_sql(stmt.format(line), engine) ip = get_ipython() ip.register_magics(CustomSampleRows) noteable
  • 36. 36 3.2 Custom UI (99 UI problems but customizing makes it 100) noteable
  • 37. 37 3.2 Custom UI Components noteable
  • 38. 38 3.2 Custom UI Components Useful component libraries to get you started: ● nteract ● BlueprintJS ● … or write your own :) noteable
  • 39. 39 3.3 Other ideas for customization Depending on your environment & users, you might consider: ● custom kernels ● advanced magics ● complex extensions ● deep integrations ● autocomplete & linting noteable
  • 40. Join the Noteable Insiders Become a Noteable Insider at noteable.io/insider-program Michelle Ufford CEO Elijah Meeks Chief Visualization Officer Matthew Seal Chief Technology Officer Carol Willing Lead Technical Evangelist Help us create a better SQL experience! 🙂 Meet the Noteable team noteableSlides available at noteable.io/jupytercon
  • 41. 1.1 Resources 41 1.1 Set up JupyterHub (or a similar multi-user hosted environment) ● JupyterHub ● JupyterHub docs ● The Littlest JupyterHub ● Zero to JupyterHub with Kubernetes ● JupyterLab and JupyterHub - Perfect Together | Carol Willing @ PyBay2018 ● Configuring user environments — JupyterHub 1.1.0 documentation noteable
  • 42. 1.2 Resources 42 1.2 Add support for SQL Magics to your base Docker image ● ipython-sql ● SQL Magic with ipython-sql ● Jupyter Magics with SQL ● Make Jupyter/IPython Notebook even more magical with cell magic extensions! ● SQL Interface within JupyterLab noteable
  • 43. 1.3 Resources 43 1.3 - Pre-install popular libraries in your Jupyter environment ● Jupyter Docker Stacks ● JupyterHub - Configuring user environments ● ipython-sql ● SQLAlchemy ● Awesome Python’s Curated List of Awesome Frameworks ● Python Library: The 21 Best Libraries for Python Programmers noteable
  • 44. 1.4 Resources 44 1.4 - Install useful extensions for your users ● JupyterLab-SQL ● The Littlest JupyterHub - Enabling Jupyter Notebook extensions ● Adding Jupyter Notebook Extensions to a Docker Image ● Distributing Jupyter Extensions as Python Packages ● Unofficial Jupyter Notebook Extensions ● jupyterlab-extension public repos on GitHub ● The Top 47 Jupyterlab Extension Open Source Projects ● PyData Austin 2019: Customizing JupyterLab using extensions noteable
  • 45. 2.1 Resources 45 2.1 Secure connections in your JupyterHub with Enterprise Gateway ● Jupyter Enterprise Gateway on GitHub ● Jupyter Enterprise Gateway ● Jupyter Enterprise Gateway - Security Features ● Strata - Scaling Jupyter with Jupyter Enterprise Gateway ● Building analytical microservices powered by Jupyter Kernels - Luciano Resende & Kevin Bates noteable
  • 46. 2.2 Resources 46 2.2 Simplify life with simple environment variables ● Zero to JupyterHub - Set Environment Variables ● How to Use Jupyter Notebooks with Apache Spark - Setting Jupyter env variables ● Example - jupyter / docker-stacks / pyspark-notebook on GitHub ● Configuring user environments — JupyterHub 1.1.0 documentation noteable
  • 47. 2.3 Resources 47 2.3 Automate workflows & integrate systems using Papermill templates ● Papermill on GitHub ● Papermill docs ● Beyond Interactive: Notebook Innovation at Netflix ● Beyond Interactive, Part 2: Scheduling Notebooks at Netflix ● Introduction to Papermill ● Data Council - Notebooks as Functions with Papermill | Netflix ● Reusable Execution in Production Using Papermill (Google Cloud AI Huddle) noteable
  • 48. 3.1 Resources 48 3.1 Create a magical experience for SQL users with custom SQL Magics ● Creating Custom Magic Commands in Jupyter ● Creating an IPython extension with custom magic commands ● SparkMagic ● Presto Magic noteable
  • 49. 3.2 Resources 49 3.2 Take convenience to the next level with custom UI components ● nteract ● nteract on GitHub ● nteract component docs ● BlueprintJS ● Using JupyterLab components ● A very simple demo of interactive controls on Jupyter notebook noteable
  • 50. 3.3 Resources 50 3.3 Create a custom Jupyter experience tailored to your company/organization ● JupyterLab - Common Extension Points ● JupyterLab Extension Developer Guide ● How to Write a Jupyter Notebook Extension ● Example IPython magic functions for Pyspark ● Making kernels for Jupyter noteable

Notas do Editor

  1. Since the jupyterhub-singleuser server extends the standard Jupyter notebook server, most configuration and documentation that applies to Jupyter Notebook applies to the single-user environments. Configuration of user environments typically does not occur through JupyterHub itself, but rather through system- wide configuration of Jupyter, which is inherited by jupyterhub-singleuser. Tip: When searching for configuration tips for JupyterHub user environments, try removing JupyterHub from your search because there are a lot more people out there configuring Jupyter than JupyterHub and the configuration is the same.