Jupyter notebook to run Spark. Some extensions are included.
446
Dockerfile based on jupyter/all-spark-notebook extended with jupyter-vim-binding.
Some features:

import pandas as pd
from sqlalchemy import create_engine
from pyspark import SparkContext
from pyspark.sql import SQLContext
sc = SparkContext("local[*]")
sqlsc = SQLContext(sc)
## Connection to a local PostgreSQL.
pgeng = create_engine('postgresql://postgres:postgres@localhost:5432/postgres')
pd.read_sql("select * from SOME_TABLE;", pgeng)
An example of usage in Python:
from pyspark import SparkContext
from pyspark.sql import SQLContext
sc = SparkContext("local[*]")
sqlsc = SQLContext(sc)
jdbcOpts = {'url' : 'jdbc:postgresql://localhost:5432/postgres',
'driver' : 'org.postgresql.Driver',
'user' : 'postgres',
'password' : 'postgres'
}
df = sqlsc.read.jdbc(
url = jdbcOpts["url"],
## This query is executed in the database.
table = '(select * from SOME_TABLE limit 1000) as table',
properties = jdbcOpts
)
df.describe().show()
Content type
Image
Digest
Size
2.1 GB
Last updated
over 9 years ago
docker pull boechat107/ext-spark-notebook