Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pyspark read from redshift

from pyspark.sql import SQLContext

sc = # existing SparkContext
sql_context = SQLContext(sc)

# Read data from a table
df = sql_context.read 
    .format("com.databricks.spark.redshift") 
    .option("url", "jdbc:redshift://redshifthost:5439/database?user=username&password=pass") 
    .option("dbtable", "my_table") 
    .option("tempdir", "s3n://path/for/temp/data") 
    .load()
 
PREVIOUS NEXT
Tagged: #pyspark #read #redshift
ADD COMMENT
Topic
Name
1+1 =