In 2.0.0, is it possible to fetch a query from an external database (rather than grab the whole table)?

2016-08-02 Thread pgb
I'm interested in learning if it's possible to grab the results set from a query run on an external database as opposed to grabbing the full table and manipulating it later. The base code I'm working with is below (using Spark 2.0.0): ``` from pyspark.sql import SparkSession df = spark.read\

Re: In 2.0.0, is it possible to fetch a query from an external database (rather than grab the whole table)?

2016-08-02 Thread Jacek Laskowski
Hi, Don't think so. Pozdrawiam, Jacek Laskowski https://medium.com/@jaceklaskowski/ Mastering Apache Spark 2.0 http://bit.ly/mastering-apache-spark Follow me at https://twitter.com/jaceklaskowski On Tue, Aug 2, 2016 at 10:25 PM, pgb wrote: > I'm interested in learning if it's possible to

Re: In 2.0.0, is it possible to fetch a query from an external database (rather than grab the whole table)?

2016-08-02 Thread Mich Talebzadeh
You don't need to get full table. This is getting data from an Oracle table val c = HiveContext.load("jdbc", Map("url" -> _ORACLEserver,0 "dbtable" -> "(SELECT to_char(CHANNEL_ID) AS CHANNEL_ID, CHANNEL_DESC FROM sh.channels WHERE CHANNEL_ID <= 1000)", "user" -> _username, "password" -> _password)