How to use the datasketch.storage.CassandraClient function in datasketch

To help you get started, we’ve selected a few datasketch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ekzhu / datasketch / datasketch / storage.py View on Github external
def _select(self, statements_and_parameters):
            """
            Execute a list of statements and parameters returning data.

            :param iterable[tuple] statements_and_parameters: list of statements and parameters
            :rtype: list[Row]
            :return: the rows matching the queries
            """
            ret = []
            size = self.CONCURRENCY
            for sub_sequence in CassandraClient.split_sequence(statements_and_parameters, size):
                results = c_concurrent.execute_concurrent(
                    self._session,
                    sub_sequence,
                    concurrency=size,
                )
                for result in results:
                    success, rows = result
                    if success:
                        for row in rows:
                            ret.append(row)
                    else:
                        raise RuntimeError
            return ret
github ekzhu / datasketch / datasketch / storage.py View on Github external
},
                        'drop_keyspace': True,
                        'drop_tables': True,
                        'shared_buffer': False,
                    }
                }
            :param bytes name: the name
            :param int buffer_size: the buffer size
            """
            self._config = config
            if buffer_size is None:
                buffer_size = CassandraStorage.DEFAULT_BUFFER_SIZE
            cassandra_param = self._parse_config(self._config['cassandra'])
            self._name = name if name else _random_name(11).decode('utf-8')
            self._buffer_size = buffer_size
            self._client = CassandraClient(cassandra_param, name, self._buffer_size)