Search
 
SCRIPT & CODE EXAMPLE
 

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()
Comment

PREVIOUS NEXT
Code Example
Python :: labelimg yolo save format 
Python :: python how to get the angle between two points by only their x,y 
Python :: sort dict 
Python :: convert float to string python 
Python :: map a list to another list python 
Python :: python any in list 
Python :: csv read python 
Python :: pickled list 
Python :: how can I corect word spelling by use of nltk? 
Python :: matrix diagonal sum python 
Python :: how to comment text in python 
Python :: boxplot python 
Python :: multi threading in python for 2 different functions with return 
Python :: seaborn green color palette python 
Python :: access column pandas 
Python :: is in array python 
Python :: number of elements in the array numpy 
Python :: pandas df.to_csv() accent in columns name 
Python :: python web framework 
Python :: function to remove punctuation in python 
Python :: open pdfs using python 
Python :: replace character in string python by index 
Python :: remove french stopwords with spacy 
Python :: python append row to 2d array 
Python :: Flatten List in Python Using NumPy flat 
Python :: pandas subplots 
Python :: django form formatting 
Python :: python object name 
Python :: print each element of list in new line python 
Python :: empty array python 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =