Cassandra Pojo Sink Flink 中的动态表名称 [英] Dynamic Table name in Cassandra Pojo Sink Flink

查看:30
本文介绍了Cassandra Pojo Sink Flink 中的动态表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Apache Flink 的新手.我正在使用 Pojo Sink 将数据加载到 Cassandra 中.现在,我正在 @Table 注释的帮助下指定表和键空间名称.
现在,我想在运行时动态传递表名和键空间名,以便我可以将数据加载到用户指定的表中.有什么办法可以做到这一点吗?

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?

推荐答案

@Table 是一个 CQL 注释,用于定义该类实体映射到哪个表.AFAIK,目前没有办法让它在运行时动态映射到任何表,因为如果没有指定名称,它会推断类名称,即

@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 {...}

推断表'mytable'

infers a table 'mytable'

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

推断表'another_table'

infers the table 'another_table'

这篇关于Cassandra Pojo Sink Flink 中的动态表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆