コード例 #1
0
def verify_container_is_up(settings):
    conn = CassandraConnectionManager(settings)
    conn.get_session('system').execute("""
        CREATE KEYSPACE IF NOT EXISTS test 
        WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : '1'};"""
                                       )

    return conn
コード例 #2
0
    def _state_manager_connect(self):

        LOG.info("Connecting to Cassandra")

        conn = CassandraConnectionManager(
            self.__settings.etl_state_manager_connection)
        conn.setup_connection(self.__settings.etl_state_manager_keyspace)

        LOG.info("Cassandra connection established")

        sync_etl_state_table()
コード例 #3
0
def connect(host, port):
    conn = CassandraConnectionManager(
        CassandraConnectionSettings(
            cluster_ips=[host],
            port=port,
            load_balancing_policy=DCAwareRoundRobinPolicy(),
            secrets_manager=CassandraSecretsManager(
                source=DictKeyValueSource({
                    "CASSANDRA_USERNAME": "",
                    "CASSANDRA_PASSWORD": "",
                })),
        ))
    conn.get_session('system').execute("""
        CREATE KEYSPACE IF NOT EXISTS dev 
        WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : '1'};"""
                                       )
    return conn
コード例 #4
0
 def _state_manager_connect(self):
     conn = CassandraConnectionManager(
         self.__settings.etl_state_manager_connection)
     conn.setup_connection(self.__settings.etl_state_manager_keyspace)
     sync_etl_state_table()
コード例 #5
0
 def _get_cassandra_util(self):
     return CassandraUtil(
         keyspace=self.__settings.destination_keyspace,
         conn=CassandraConnectionManager(
             settings=self.__settings.destination_connection_settings),
     )