>From my experience so far, update mode in structured streaming is the most
useful one out of the three available modes. But when it comes it RDBMS
there isn't really an upsert so If I go with ForEachWriter I wouldn't quite
know when to do an Insert or an update unless I really tie it with my
application logic (other words it wont look generic or seamless). so if
spark can provide me additional info on a certain row is an update of the
existing one or if it is a new row altogether then it becomes easy to
figure out if I need to insert or update and I don't really need to tie it
with my application logic.




On Thu, Jun 21, 2018 at 6:49 AM, Lalwani, Jayesh <
jayesh.lalw...@capitalone.com> wrote:

> Open source Spark Structured Streaming doesn’t have a JDBC sink.  You can
> implement your own ForEachWriter, or you can use my sink from here
>
> https://github.com/GaalDornick/spark/blob/master/
> sql/core/src/main/scala/org/apache/spark/sql/execution/
> streaming/JdbcSink.scala
>
> https://github.com/GaalDornick/spark/blob/master/
> sql/core/src/main/scala/org/apache/spark/sql/execution/
> streaming/JDBCSinkLog.scala
>
>
>
>
>
>
>
> *From: *kant kodali <kanth...@gmail.com>
> *Date: *Wednesday, June 20, 2018 at 9:10 PM
> *To: *"user @spark" <user@spark.apache.org>
> *Subject: *Does Spark Structured Streaming have a JDBC sink or Do I need
> to use ForEachWriter?
>
>
>
> Hi All,
>
>
>
> Does Spark Structured Streaming have a JDBC sink or Do I need to use
> ForEachWriter? I see the following code in this link
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__databricks.com_blog_2016_07_28_structured-2Dstreaming-2Din-2Dapache-2Dspark.html&d=DwMFaQ&c=pLULRYW__RtkwsQUPxJVDGboCTdgji3AcHNJU0BpTJE&r=F2RNeGILvLdBxn7RJ4effes_QFIiEsoVM2rPi9qX1DKow5HQSjq0_WhIW109SXQ4&m=FcA0Wjzr2amsglZyxyPuqiiwri2w5og155ep4snnVL0&s=06Y3TaQOdWi2I1xcJfXfNqg0k4tjAwsomT87XQVBQ5g&e=>
>  and
> I can see that database name can be passed in the connection string,
> however, I wonder how to pass a table name?
>
>
>
> inputDF.groupBy($"action", window($"time", "1 hour")).count()
>
>        .writeStream.format("jdbc")
>
>        .save("jdbc:mysql//…")
>
>
>
> Thanks,
>
> Kant
>
> ------------------------------
>
> The information contained in this e-mail is confidential and/or
> proprietary to Capital One and/or its affiliates and may only be used
> solely in performance of work or services for Capital One. The information
> transmitted herewith is intended only for use by the individual or entity
> to which it is addressed. If the reader of this message is not the intended
> recipient, you are hereby notified that any review, retransmission,
> dissemination, distribution, copying or other use of, or taking of any
> action in reliance upon this information is strictly prohibited. If you
> have received this communication in error, please contact the sender and
> delete the material from your computer.
>

Reply via email to