def test_table_exists_with_keyspace_from_session(self): hook = CassandraHook("cassandra_default_with_schema") session = hook.get_conn() cqls = [ "DROP TABLE IF EXISTS t", "CREATE TABLE t (pk1 text PRIMARY KEY)", ] for cql in cqls: session.execute(cql) self.assertTrue(hook.table_exists("t")) self.assertFalse(hook.table_exists("u")) session.shutdown() hook.shutdown_cluster()
def test_table_exists_with_keyspace_from_session(self): hook = CassandraHook("cassandra_default_with_schema") session = hook.get_conn() cqls = [ "DROP TABLE IF EXISTS t", "CREATE TABLE t (pk1 text PRIMARY KEY)", ] for cql in cqls: session.execute(cql) self.assertTrue(hook.table_exists("t")) self.assertFalse(hook.table_exists("u")) session.shutdown() hook.shutdown_cluster()
def poke(self, context): self.log.info('Sensor check existence of table: %s', self.table) hook = CassandraHook(self.cassandra_conn_id) return hook.table_exists(self.table)
def poke(self, context): self.log.info('Sensor check existence of table: %s', self.table) hook = CassandraHook(self.cassandra_conn_id) return hook.table_exists(self.table)