Skip to content

Instantly share code, notes, and snippets.

@ptitzler
Last active May 19, 2017 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptitzler/f6bfe171c5dd8bc72f14ee8e48efe033 to your computer and use it in GitHub Desktop.
Save ptitzler/f6bfe171c5dd8bc72f14ee8e48efe033 to your computer and use it in GitHub Desktop.
PySpark SQL load snippet
jdbcurl = 'jdbc:db2://MYHOST:MYPORT/MYDATABASE'
props = {}
props['user'] = 'MYUSERID'
props['password'] = 'MYPASSWORD'
my_df = sqlContext.read.jdbc(jdbcurl, 'MYSCHEMA.MYTABLE', properties=props)
my_df.cache()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment