back-end/utils/export_collection_data_module.py
def export_to_csv(cursor, dataset_name, csv_header, path):
    """ This function extracts data from the cursor, then produces a valid csv file with csv_header and saves it
        to the path.
    @parameters
        cursor          (cursor)    MongoDB's result cursor
        dataset_name    (str)       the name of the produced file
        csv_header      (list)      list of string that correspond to key names for each row
        path            (str)       the path to save the produced file
    """

    print("\tExporting Collection to csv File...")
    if cursor.count() == 0:
        try:
            raise Warning("No documents retrieved")
        except Exception as e:
            print("\nexport_collection_data module > export_to_csv: ", e)
            return

    doc_cursor_list = list(cursor)
    docs = pd.DataFrame(doc_cursor_list)
    docs.to_csv(path_or_buf=path+dataset_name, header=csv_header, columns=csv_header, index=False)

    # -----------------------------------------------------------------------------------------------------------------#

 This function extracts data from the cursor, then produces a valid csv file with csv_header and saves it
        to the path.
    @parameters
        cursor          (cursor)    MongoDB's result cursor
        dataset_name    (str)       the name of the produced file
        csv_header      (list)      list of string that correspond to key names for each row
        path            (str)       the path to save the produced file
    
This function extracts data from the cursor, then produces a valid csv file with csv_header and saves it
to the path.
@parameters
cursor          (cursor)    MongoDB's result cursor
dataset_name    (str)       the name of the produced file
csv_header      (list)      list of string that correspond to key names for each row
path            (str)       the path to save the produced file
This function extracts data from the cursor then produces a valid csv file with csv_header and saves it to the path . @parameters cursor ( cursor ) MongoDB ' s result cursor dataset_name ( str ) the name of the produced file csv_header ( list ) list of string that correspond to key names for each row path ( str ) the path to save the produced file
def export_to_csv(cursor, dataset_name, csv_header, path):
    print("\tExporting Collection to csv File...")
    if cursor.count() == 0:
        try:
            raise Warning("No documents retrieved")
        except Exception as e:
            print("\nexport_collection_data module > export_to_csv: ", e)
            return
    doc_cursor_list = list(cursor)
    docs = pd.DataFrame(doc_cursor_list)
    docs.to_csv(path_or_buf=path+dataset_name, header=csv_header, columns=csv_header, index=False)
def export_to_csv ( cursor , dataset_name , csv_header , path ) : print ( "\tExporting Collection to csv File..." ) if cursor . count ( ) == 0 : try : raise Warning ( "No documents retrieved" ) except Exception as e : print ( "\nexport_collection_data module > export_to_csv: " , e ) return doc_cursor_list = list ( cursor ) docs = pd . DataFrame ( doc_cursor_list ) docs . to_csv ( path_or_buf = path + dataset_name , header = csv_header , columns = csv_header , index = False )
This function extracts data from the cursor, then produces a valid csv file with csv_header and saves it
to the path.
This function extracts data from the cursor then produces a valid csv file with csv_header and saves it to the path .
""" This function extracts data from the cursor, then produces a valid csv file with csv_header and saves it
        to the path.
    @parameters
        cursor          (cursor)    MongoDB's result cursor
        dataset_name    (str)       the name of the produced file
        csv_header      (list)      list of string that correspond to key names for each row
        path            (str)       the path to save the produced file
    """ # -----------------------------------------------------------------------------------------------------------------#

cursor
dataset_name
csv_header
path