Answers for "pyspark read from redshift"

0

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()
Posted by: Guest on February-26-2021

Code answers related to "pyspark read from redshift"

Python Answers by Framework

Browse Popular Code Answers by Language