コード例 #1
0
def transfer_file(data_file):
    """Transfer contents of soakdb.sqlite file to xcdb into separate
    (crystal, lab, refinement, dimple and data_processing tables.

    :param data_file: File-path(?) pointing towards a soakdb.sqlite file
    :type data_file: str
    :return: Function should not return anything but will write to a database.
    :rtype: None
    """
    maint_exists = db_functions.check_table_sqlite(data_file, 'mainTable')
    if maint_exists == 1:
        db_functions.transfer_table(translate_dict=db_functions.crystal_translations(), filename=data_file,
                                    model=Crystal)
        db_functions.transfer_table(translate_dict=db_functions.lab_translations(), filename=data_file,
                                    model=Lab)
        db_functions.transfer_table(translate_dict=db_functions.refinement_translations(), filename=data_file,
                                    model=Refinement)
        db_functions.transfer_table(translate_dict=db_functions.dimple_translations(), filename=data_file,
                                    model=Dimple)
        db_functions.transfer_table(translate_dict=db_functions.data_processing_translations(),
                                    filename=data_file, model=DataProcessing)

    soakdb_query = SoakdbFiles.objects.get(filename=data_file)
    soakdb_query.status = 2
    soakdb_query.save()
コード例 #2
0
def transfer_file(data_file):
    maint_exists = db_functions.check_table_sqlite(data_file, 'mainTable')
    if maint_exists == 1:
        db_functions.transfer_table(
            translate_dict=db_functions.crystal_translations(),
            filename=data_file,
            model=Crystal)
        db_functions.transfer_table(
            translate_dict=db_functions.lab_translations(),
            filename=data_file,
            model=Lab)
        db_functions.transfer_table(
            translate_dict=db_functions.refinement_translations(),
            filename=data_file,
            model=Refinement)
        db_functions.transfer_table(
            translate_dict=db_functions.dimple_translations(),
            filename=data_file,
            model=Dimple)
        db_functions.transfer_table(
            translate_dict=db_functions.data_processing_translations(),
            filename=data_file,
            model=DataProcessing)

    soakdb_query = SoakdbFiles.objects.get(filename=data_file)
    soakdb_query.status = 2
    soakdb_query.save()