如何从 cassandra 会话获取密钥空间名称



当我创建会话时,将keyspace_name作为API集群.connect(keyspaceName(的输入。无论如何/api,我可以从会话中获取keyspace_name吗?

会话创建

String cKeyspace="inventory_flip"
Session session = cluster.connect(cKeyspace);

如何从现有的Cassandra DB会话中获取密钥空间?

session.getXXXXX?
public interface Session extends Closeable {
  /**
   * The keyspace to which this Session is currently logged in, if any.
   *
   * <p>This correspond to the name passed to {@link Cluster#connect(String)}, or to the last
   * keyspace logged into through a "USE" CQL query if one was used.
   *
   * @return the name of the keyspace to which this Session is currently logged in, or {@code null}
   *     if the session is logged to no keyspace.
   */
  String getLoggedKeyspace();

相关内容

  • 没有找到相关文章

最新更新