You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Koen Vantomme <ko...@gmail.com> on 2015/06/19 16:33:45 UTC

Cassandra - Spark 1.3 - reading data from cassandra table with PYSpark

Hello,

I'm trying to read data from a table stored in cassandra with pyspark.
I found the scala code to loop through the table :
"cassandra_rdd.toArray.foreach(println)"

How can this be translated into PySpark  ?

code snipplet :
sc_cass = CassandraSparkContext(conf=conf)
cassandra_rdd = sc_cass.cassandraTable("tutorial", "user")
#cassandra_rdd.toArray.foreach(println)
cassandra_rdd.

Regards,
Koen

Re: Cassandra - Spark 1.3 - reading data from cassandra table with PYSpark

Posted by Davies Liu <da...@databricks.com>.
On Fri, Jun 19, 2015 at 7:33 AM, Koen Vantomme <ko...@gmail.com> wrote:
> Hello,
>
> I'm trying to read data from a table stored in cassandra with pyspark.
> I found the scala code to loop through the table :
> "cassandra_rdd.toArray.foreach(println)"
>
> How can this be translated into PySpark  ?
>
> code snipplet :
> sc_cass = CassandraSparkContext(conf=conf)
> cassandra_rdd = sc_cass.cassandraTable("tutorial", "user")
> #cassandra_rdd.toArray.foreach(println)

for row in cassandra_rdd.collect():
  print(row)
> cassandra_rdd.
>
> Regards,
> Koen

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org