当前位置: 首页>>代码示例>>Python>>正文


Python SIMSConn.rows方法代码示例

本文整理汇总了Python中coredata.queries.SIMSConn.rows方法的典型用法代码示例。如果您正苦于以下问题:Python SIMSConn.rows方法的具体用法?Python SIMSConn.rows怎么用?Python SIMSConn.rows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在coredata.queries.SIMSConn的用法示例。


在下文中一共展示了SIMSConn.rows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: import_students

# 需要导入模块: from coredata.queries import SIMSConn [as 别名]
# 或者: from coredata.queries.SIMSConn import rows [as 别名]
def import_students(offering):
    Member.objects.filter(added_reason="AUTO", offering=offering, role="STUD").update(role='DROP')
    db = SIMSConn()
    # find any lab/tutorial sections
    
    # c1 original lecture section
    # c2 related lab/tutorial section
    # s students in c2
    # WHERE lines: (1) match lab/tut sections of c1 class (2) students in those
    # lab/tut sections (3) with c1 matching offering
    query = "SELECT s.emplid, c2.class_section " \
        "FROM ps_class_tbl c1, ps_class_tbl c2, ps_stdnt_enrl s " \
        "WHERE c1.subject=c2.subject and c1.catalog_nbr=c2.catalog_nbr and c2.strm=c1.strm " \
        "and s.class_nbr=c2.class_nbr and s.strm=c2.strm and s.enrl_status_reason IN ('ENRL','EWAT') " \
        "and c1.class_nbr=%s and c1.strm=%s and c2.class_section LIKE %s"
    db.execute(query, (offering.class_nbr, offering.semester.name, offering.section[0:2]+"%"))
    labtut = {}
    for emplid, section in db:
        if section == offering.section:
            # not interested in lecture section now.
            continue
        labtut[emplid] = section
    
    db.execute("SELECT e.emplid, e.acad_career, e.unt_taken, e.crse_grade_off, r.crse_grade_input "
               "FROM ps_stdnt_enrl e LEFT JOIN ps_grade_roster r "
               "ON e.strm=r.strm and e.acad_career=r.acad_career and e.emplid=r.emplid and e.class_nbr=r.class_nbr "
               "WHERE e.class_nbr=%s and e.strm=%s and e.stdnt_enrl_status='E' and "
               "e.enrl_status_reason IN ('ENRL','EWAT')", (offering.class_nbr, offering.semester.name))
    for emplid, acad_career, unt_taken, grade_official, grade_roster in db.rows():
        p = get_person(emplid)
        sec = labtut.get(emplid, None)
        grade = grade_official or grade_roster
        ensure_member(p, offering, "STUD", unt_taken, "AUTO", acad_career, labtut_section=sec, grade=grade)
开发者ID:sfu-fas,项目名称:coursys,代码行数:35,代码来源:importer.py

示例2: import_instructors

# 需要导入模块: from coredata.queries import SIMSConn [as 别名]
# 或者: from coredata.queries.SIMSConn import rows [as 别名]
def import_instructors(offering):
    "Import instructors for this offering"
    Member.objects.filter(added_reason="AUTO", offering=offering, role="INST").update(role='DROP')
    db = SIMSConn()
    db.execute("SELECT emplid, instr_role, sched_print_instr FROM ps_class_instr WHERE " \
               "crse_id=%s and class_section=%s and strm=%s and instr_role IN ('PI', 'SI')",
               ("%06i" % (int(offering.crse_id)), offering.section, offering.semester.name))
    for emplid, _, sched_print_instr in db.rows():
        if not emplid:
            continue
        p = get_person(emplid)
        ensure_member(p, offering, "INST", 0, "AUTO", "NONS", sched_print_instr=sched_print_instr)
开发者ID:sfu-fas,项目名称:coursys,代码行数:14,代码来源:importer.py

示例3: import_all_instructors

# 需要导入模块: from coredata.queries import SIMSConn [as 别名]
# 或者: from coredata.queries.SIMSConn import rows [as 别名]
def import_all_instructors(strm, extra_where='1=1', offering_map=None):
    if not offering_map:
        offering_map = crseid_offering_map(strm)

    Member.objects.filter(added_reason="AUTO", offering__semester__name=strm, role="INST").update(role='DROP')
    db = SIMSConn()
    db.execute("SELECT crse_id, class_section, strm, emplid, instr_role, sched_print_instr FROM ps_class_instr WHERE " \
               "strm=%s AND instr_role IN ('PI', 'SI') AND " + extra_where,
               (strm,))

    for crse_id, class_section, strm, emplid, instr_role, sched_print_instr in db.rows():
        if not emplid or (strm, crse_id, class_section) not in offering_map:
            continue
        offering = offering_map[(strm, crse_id, class_section)]
        p = get_person(emplid)
        ensure_member(p, offering, "INST", 0, "AUTO", "NONS", sched_print_instr=sched_print_instr)
开发者ID:sfu-fas,项目名称:coursys,代码行数:18,代码来源:importer.py

示例4: import_offerings

# 需要导入模块: from coredata.queries import SIMSConn [as 别名]
# 或者: from coredata.queries.SIMSConn import rows [as 别名]
def import_offerings(extra_where='1=1', import_semesters=import_semesters, cancel_missing=False, create_units=False):
    db = SIMSConn()
    db.execute(CLASS_TBL_QUERY + " AND ct.strm IN %s "
               " AND ("+extra_where+")", (import_semesters(),))
    imported_offerings = set()
    for row in db.rows():
        o = import_offering(*row, create_units=create_units)
        if o:
            imported_offerings.add(o)

    if cancel_missing:
        # mark any offerings not found during the import as cancelled: handles sections that just disappear from
        # ps_class_tbl, because that can happen, apparently.
        all_off = CourseOffering.objects.filter(semester__name__in=import_semesters()) \
            .exclude(component='CAN').exclude(flags=CourseOffering.flags.combined)
        all_off = set(all_off)
        for o in all_off - imported_offerings:
            o.component = 'CAN'
            o.save()
    
    return imported_offerings
开发者ID:sfu-fas,项目名称:coursys,代码行数:23,代码来源:importer.py


注:本文中的coredata.queries.SIMSConn.rows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。