(self, streamer, data_type='', columns=None)
Go through loaded config and setup a streamer if there is a match.

        This function takes a streamer object and compares the loaded config
        to see if there is a match to the data_type and/or columns that are
        supplied to the function and sets the streamer up if a matching
        config is discovered.

        The helper will use the first match in the config to setup the
        streamer (it will exit as soon as it finds a match).

        Args:
            streamer (ImportStreamer): an import streamer object.
            data_type (str): optional data type that is used for matching
                with the loaded config.
            columns (List[str]): optional list of strings with column names.
Go through loaded config and setup a streamer if there is a match.
Go through loaded config and setup a streamer if there is a match .
def configure_streamer(self, streamer, data_type='', columns=None):
        """Go through loaded config and setup a streamer if there is a match.

        This function takes a streamer object and compares the loaded config
        to see if there is a match to the data_type and/or columns that are
        supplied to the function and sets the streamer up if a matching
        config is discovered.

        The helper will use the first match in the config to setup the
        streamer (it will exit as soon as it finds a match).

        Args:
            streamer (ImportStreamer): an import streamer object.
            data_type (str): optional data type that is used for matching
                with the loaded config.
            columns (List[str]): optional list of strings with column names.
        """
        for config_name, config in self._data.items():
            conf_data_type = config.get('data_type')
            if data_type and conf_data_type and conf_data_type == data_type:
                logger.info('Using config %s for streamer.', config_name)
                self._configure_streamer(streamer, config)
                return

            if not columns:
                continue

            column_set = set(columns)
            column_string = config.get('columns', '')
            column_subset_string = config.get('columns_subset', '')
            if not any([column_string, column_subset_string]):
                continue

            conf_columns = set(column_string.split(','))
            if conf_columns and column_set == conf_columns:
                logger.info('Using config %s for streamer.', config_name)
                self._configure_streamer(streamer, config)
                return

            columns_subset = set(column_subset_string.split(','))
            if columns_subset and columns_subset.issubset(column_set):
                logger.info('Using config %s for streamer.', config_name)
                self._configure_streamer(streamer, config)
                return
def configure_streamer ( self , streamer , data_type = '' , columns = None ) : for config_name , config in self . _data . items ( ) : conf_data_type = config . get ( 'data_type' ) if data_type and conf_data_type and conf_data_type == data_type : logger . info ( 'Using config %s for streamer.' , config_name ) self . _configure_streamer ( streamer , config ) return if not columns : continue column_set = set ( columns ) column_string = config . get ( 'columns' , '' ) column_subset_string = config . get ( 'columns_subset' , '' ) if not any ( [ column_string , column_subset_string ] ) : continue conf_columns = set ( column_string . split ( ',' ) ) if conf_columns and column_set == conf_columns : logger . info ( 'Using config %s for streamer.' , config_name ) self . _configure_streamer ( streamer , config ) return columns_subset = set ( column_subset_string . split ( ',' ) ) if columns_subset and columns_subset . issubset ( column_set ) : logger . info ( 'Using config %s for streamer.' , config_name ) self . _configure_streamer ( streamer , config ) return