Dynamic Table name in Cassandra Pojo Sink Flink

混江龙づ霸主 提交于 2021-01-27 07:06:06

问题


I am a newbie to Apache Flink. I am using Pojo Sink to load the data into Cassandra. Right now, I am specifying table and keyspace names with the help of @Table annotation.
Now, I want to pass table name and keyspace name dynamically on run time so that I can load data into tables specified by user. Is there any way to achieve this?


回答1:


@Table is a CQL annotation that defines which table this class entity maps to. AFAIK, currently there is no way to make it dynamically mapped to any table at run time, because it would infer to the class name if the name is not specified, i.e.

@Table
public class MyTable {...}

infers a table 'mytable'

@Table(table = "another_table")
public class AnotherTable 

infers the table 'another_table'



来源:https://stackoverflow.com/questions/41183039/dynamic-table-name-in-cassandra-pojo-sink-flink

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!