Пример #1
0
def main(argv):
    trost_plants = sql.get_plants()
    trost_cultures = sql.get_cultures()

    bad_plants = []

    for aliquot_id, plant_id in trost_plants.iteritems():
        culture_id = ora_sql.get_culture_id(aliquot_id)
        if (trost_cultures.has_key(culture_id)):
            print "UPDATE `plants` SET culture_id = %d WHERE id = %d;" % (trost_cultures[culture_id], plant_id)
        else:
            bad_plants.append(plant_id)

    if len(bad_plants) > 0:
        print bad_plants

    return None
Пример #2
0
def main(argv):
    trost_plants = sql.get_plants()
    trost_cultures = sql.get_cultures()

    bad_plants = []

    for aliquot_id, plant_id in trost_plants.iteritems():
        culture_id = ora_sql.get_culture_id(aliquot_id)
        if (trost_cultures.has_key(culture_id)):
            print "UPDATE `plants` SET culture_id = %d WHERE id = %d;" % (
                trost_cultures[culture_id], plant_id)
        else:
            bad_plants.append(plant_id)

    if len(bad_plants) > 0:
        print bad_plants

    return None
Пример #3
0
def main(argv):
    missing_plant_ids = sql.get_plants_culivar_of('DESIREE')

    trost_subspecies = sql.get_subspecies()  # subspecies: PK id
    trost_cultures = sql.get_cultures()  # cultures: PK id
    bad_plants = []

    for aliquot_id in missing_plant_ids:
        plant = ora_sql.get_pedigree_plant_information(aliquot_id)

        if trost_subspecies.has_key(plant['subspecies_id']):
            print """
            INSERT INTO `plants` (id, name, aliquot, culture_id, subspecies_id, created)
            VALUES (NULL, NULL, %d, %d, %d, NOW());
            """.strip() % (plant['aliquot_id'],
                           trost_cultures[plant['culture_id']],
                           trost_subspecies[plant['subspecies_id']])
        else:
            bad_plants.append(aliquot_id)

    if len(bad_plants) > 0:
        print bad_plants
Пример #4
0
def main(argv):
    missing_plant_ids = sql.get_missing_plants(2) + sql.get_missing_plants(7)

    trost_subspecies = sql.get_subspecies()  # subspecies: PK id
    trost_cultures = sql.get_cultures()  # cultures: PK id
    bad_plants = []

    for aliquot_id in missing_plant_ids:
        plant = ora_sql.get_plant_information(aliquot_id)

        if trost_subspecies.has_key(plant["subspecies_id"]):
            print """
            INSERT INTO `plants` (id, name, aliquot, culture_id, subspecies_id, created)
            VALUES (NULL, NULL, %d, %d, %d, NOW());
            """.strip() % (
                plant["aliquot_id"],
                trost_cultures[plant["culture_id"]],
                trost_subspecies[plant["subspecies_id"]],
            )
        else:
            bad_plants.append(aliquot_id)

    if len(bad_plants) > 0:
        print bad_plants