How to make two insert-into sqls orderly

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to make two insert-into sqls orderly

Izual

We have two output sinks, and the order assurance is achieved by code like this:

record.apply(insert_into_sink1).thenApply(

recorder_2 = foo(record)

recorder_2.insert_into_sink2

)

So when sink2 receives the record_2, record must be existed in sink1, then we can seek corresponding value of record from sink1, and do next.


Is this could be implemented on SQL? It seems like all is done by FLINK-SQL


INSERT INTO sink1 SELECT ...

INSERT INTO sink2 SELECT ...

Is there anyway to make sure the order of these two insert-into sqls.



 

Reply | Threaded
Open this post in threaded view
|

Re: How to make two insert-into sqls orderly

Benchao Li
Hi izual,

AFAIK, there is no way to to this in pure SQL.




izual <[hidden email]> 于2020年3月25日周三 下午10:33写道:

We have two output sinks, and the order assurance is achieved by code like this:

record.apply(insert_into_sink1).thenApply(

recorder_2 = foo(record)

recorder_2.insert_into_sink2

)

So when sink2 receives the record_2, record must be existed in sink1, then we can seek corresponding value of record from sink1, and do next.


Is this could be implemented on SQL? It seems like all is done by FLINK-SQL


INSERT INTO sink1 SELECT ...

INSERT INTO sink2 SELECT ...

Is there anyway to make sure the order of these two insert-into sqls.



 



--
Benchao Li
School of Electronics Engineering and Computer Science, Peking University
Tel:+86-15650713730
Email: [hidden email]; [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How to make two insert-into sqls orderly

Zhenghua Gao
Hi izual,
There is a  workaround that you could implement your own sink which write record sink1 and sink2 in turn.

Best Regards,
Zhenghua Gao


On Wed, Mar 25, 2020 at 10:41 PM Benchao Li <[hidden email]> wrote:
Hi izual,

AFAIK, there is no way to to this in pure SQL.




izual <[hidden email]> 于2020年3月25日周三 下午10:33写道:

We have two output sinks, and the order assurance is achieved by code like this:

record.apply(insert_into_sink1).thenApply(

recorder_2 = foo(record)

recorder_2.insert_into_sink2

)

So when sink2 receives the record_2, record must be existed in sink1, then we can seek corresponding value of record from sink1, and do next.


Is this could be implemented on SQL? It seems like all is done by FLINK-SQL


INSERT INTO sink1 SELECT ...

INSERT INTO sink2 SELECT ...

Is there anyway to make sure the order of these two insert-into sqls.



 



--
Benchao Li
School of Electronics Engineering and Computer Science, Peking University
Tel:+86-15650713730
Email: [hidden email]; [hidden email]