src/dirbs/listgen/generator.py
def _populate_new_notifications_list(self, operator_id, executor):
        """Function to allocate new notifications triplets to new per-MNO notifications list tables."""
        with create_db_connection(self._config.db_config) as conn, conn.cursor() as cursor, CodeProfiler() as cp:
            operator_partition_name = self._notifications_lists_new_part_tblname(operator_id)
            notifications_triplets_tblname = self._notifications_triplets_new_tblname
            cursor.execute(sql.SQL("""INSERT INTO {operator_partition_name}(imei_norm,
                                                                            virt_imei_shard,
                                                                            imsi,
                                                                            msisdn,
                                                                            block_date,
                                                                            reasons,
                                                                            operator_id,
                                                                            is_valid,
                                                                            amnesty_granted,
                                                                            imei_norm_with_check_digit)
                                           SELECT imei_norm,
                                                  virt_imei_shard,
                                                  imsi,
                                                  msisdn,
                                                  block_date,
                                                  reasons,
                                                  %s,
                                                  is_valid,
                                                  amnesty_granted,
                                                  imei_norm_with_check_digit
                                             FROM {notifications_tblname}
                                            WHERE home_operator = %s
                                               OR (home_operator IS NULL
                                              AND %s = ANY(fallback_operators))
                                   """).format(operator_partition_name=sql.Identifier(operator_partition_name),
                                               notifications_tblname=sql.Identifier(notifications_triplets_tblname)),
                           [operator_id, operator_id, operator_id])
            num_records = cursor.rowcount
            self._add_pk(conn, tblname=operator_partition_name, pk_columns=['imei_norm', 'imsi', 'msisdn'])

        return num_records, cp.duration
Function to allocate new notifications triplets to new per-MNO notifications list tables.
Function to allocate new notifications triplets to new per-MNO notifications list tables.
Function to allocate new notifications triplets to new per - MNO notifications list tables .
def _populate_new_notifications_list(self, operator_id, executor):
        with create_db_connection(self._config.db_config) as conn, conn.cursor() as cursor, CodeProfiler() as cp:
            operator_partition_name = self._notifications_lists_new_part_tblname(operator_id)
            notifications_triplets_tblname = self._notifications_triplets_new_tblname
            cursor.execute(sql.SQL("""INSERT INTO {operator_partition_name}(imei_norm,
                                                                            virt_imei_shard,
                                                                            imsi,
                                                                            msisdn,
                                                                            block_date,
                                                                            reasons,
                                                                            operator_id,
                                                                            is_valid,
                                                                            amnesty_granted,
                                                                            imei_norm_with_check_digit)
                                           SELECT imei_norm,
                                                  virt_imei_shard,
                                                  imsi,
                                                  msisdn,
                                                  block_date,
                                                  reasons,
                                                  %s,
                                                  is_valid,
                                                  amnesty_granted,
                                                  imei_norm_with_check_digit
                                             FROM {notifications_tblname}
                                            WHERE home_operator = %s
                                               OR (home_operator IS NULL
                                              AND %s = ANY(fallback_operators))
                                   """).format(operator_partition_name=sql.Identifier(operator_partition_name),
                                               notifications_tblname=sql.Identifier(notifications_triplets_tblname)),
                           [operator_id, operator_id, operator_id])
            num_records = cursor.rowcount
            self._add_pk(conn, tblname=operator_partition_name, pk_columns=['imei_norm', 'imsi', 'msisdn'])
        return num_records, cp.duration
def _populate_new_notifications_list ( self , operator_id , executor ) : with create_db_connection ( self . _config . db_config ) as conn , conn . cursor ( ) as cursor , CodeProfiler ( ) as cp : operator_partition_name = self . _notifications_lists_new_part_tblname ( operator_id ) notifications_triplets_tblname = self . _notifications_triplets_new_tblname cursor . execute ( sql . SQL ( """INSERT INTO {operator_partition_name}(imei_norm,
                                                                            virt_imei_shard,
                                                                            imsi,
                                                                            msisdn,
                                                                            block_date,
                                                                            reasons,
                                                                            operator_id,
                                                                            is_valid,
                                                                            amnesty_granted,
                                                                            imei_norm_with_check_digit)
                                           SELECT imei_norm,
                                                  virt_imei_shard,
                                                  imsi,
                                                  msisdn,
                                                  block_date,
                                                  reasons,
                                                  %s,
                                                  is_valid,
                                                  amnesty_granted,
                                                  imei_norm_with_check_digit
                                             FROM {notifications_tblname}
                                            WHERE home_operator = %s
                                               OR (home_operator IS NULL
                                              AND %s = ANY(fallback_operators))
                                   """ ) . format ( operator_partition_name = sql . Identifier ( operator_partition_name ) , notifications_tblname = sql . Identifier ( notifications_triplets_tblname ) ) , [ operator_id , operator_id , operator_id ] ) num_records = cursor . rowcount self . _add_pk ( conn , tblname = operator_partition_name , pk_columns = [ 'imei_norm' , 'imsi' , 'msisdn' ] ) return num_records , cp . duration
Function to allocate new notifications triplets to new per-MNO notifications list tables.
Function to allocate new notifications triplets to new per - MNO notifications list tables .
"""Function to allocate new notifications triplets to new per-MNO notifications list tables."""
self
operator_id
executor