public boolean columnFamilyExists ( DBConn dbConn , String keyspace , String cfName ) { KsDef ksDef = null ; try { ksDef = dbConn . getClientSession ( ) . describe_keyspace ( keyspace ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Failed to get keyspace definition for '" + keyspace + "'" , ex ) ; } List < CfDef > cfDefList = ksDef . getCf_defs ( ) ; for ( CfDef cfDef : cfDefList ) { if ( cfDef . getName ( ) . equals ( cfName ) ) { return true ; } } return false ; }
Return true if the given store name currently exists in the given keyspace . This method can be used with a connection connected to any keyspace .