问题
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