• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python database.get_session函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中src.models.database.get_session函数的典型用法代码示例。如果您正苦于以下问题:Python get_session函数的具体用法?Python get_session怎么用?Python get_session使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: create_plan

def create_plan(PlanType,CourseId,Yardid,BeginDate,EndDate,WorkTime,OffTime,WeekSchedule_list_or_str,creator):
    session = database.get_session()
    p = Plan()
    p.PType = PlanType.strip()
    c = Course()
    c.CourseId = CourseId
    p.Course.append(c)
    y = Yard()
    y.Yardid = Yardid
    p.Yard.append(y)
    p.BeginDate = BeginDate
    p.EndDate = EndDate
    if PlanType.strip() == 'a': #团课
        s = ''
        for e in WeekSchedule_list_or_str:
            s+= '&'.join(e)+'^'
        p.WeekSchedule = s.strip('^')
    elif PlanType.strip() == 'b':  #私教
        p.WorkTime = WorkTime
        p.OffTime = OffTime
        p.WeekSchedule = WeekSchedule_list_or_str
    else:
        pass
    p.Creator = creator
    p.CreateDate = datetime.now()
    session.add(p)
    session.commit()
    session.close()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:28,代码来源:courseservice.py


示例2: memberAdd

def memberAdd(name,phone,webChat=None,birthday=None,address=None,expenses_not_quota_password="changeme",**args):
    """
    Add Member, the default password is 'changeme'. At the first login, we need to force change password
    """
    session=get_session()
    
    member=Member()
    
    member.name=name
    member.phone=phone
    member.expenses_not_quota_password=expenses_not_quota_password
    if not webChat is None:
        member.wchat=webChat
    if not birthday is None:
        member.birthday=birthday
    if not address is None:
        member.address=address
    
    for item in args:
        if hasattr(Member, item):
            setattr(member,item,args[item])
        else:
            raise  Exception("Member Didn't have this property: " + item)
    session.add(member)
    session.commit()
    session.close()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:26,代码来源:memberservice.py


示例3: update_plan

def update_plan(ptype,CourseId,Yardid,Coach_id,BeginDate,EndDate,WorkTime,OffTime,WeekSchedule_list_or_str,updater):
    session = database.get_session()
    updatedict = {'BeginDate':BeginDate,'EndDate':EndDate,'Modifier':updater,'LastUpdateDate':datetime.now()}
    if CourseId:
        c = Course()
        c.CourseId = CourseId
        updatedict.update({'Course':[c]})
    if Yardid:
        y = Yard()
        y.Yardid = Yardid
        updatedict.update({'Yard':[y]})
    if Coach_id:
        m = Member()
        m.UserId = Coach_id
        updatedict.update({'Coach':[m]})
    if WorkTime:
        updatedict.update({'WorkTime':WorkTime})
    if OffTime:
        updatedict.update({'OffTime':OffTime})
    if WeekSchedule_list_or_str:
        if ptype=='a':
            s = ''
            for e in WeekSchedule_list_or_str:
                s+= '&'.join(e)+'^'
            updatedict.update({'WeekSchedule':s.strip('^')})
        elif ptype=='b':
            updatedict.update({'WeekSchedule':WeekSchedule_list_or_str})
        else:
            pass
    session.query(Course).filter(Course.CourseId == CourseId).update(updatedict)
    session.commit()
    session.close()
    
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:32,代码来源:courseservice.py


示例4: update

def update(VenueId,Name,PhoneNo,Address,Email,Priority,updater):
    session = database.get_session()
    session.query(Venue).filter(Venue.VenueId == VenueId).update({'Name':Name.strip(),'PhoneNo':PhoneNo,
                                                                      'Address':Address,'Email':Email,'Priority':Priority,
                                                                      'Modifier':updater,'LastUpdateDate':datetime.now()})
    session.commit()
    session.close()    
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:7,代码来源:venueservice.py


示例5: exist_category

def exist_category(name):
    session = database.get_session()

    c = session.query(TEST_TASK).filter(TEST_TASK.TaskCaseName == name).count()

    session.close()
    return c > 0
开发者ID:flsyaoair,项目名称:guirendcos,代码行数:7,代码来源:pressuretestservice.py


示例6: update_projectProfile

def update_projectProfile(projectkey,dockerprofile):
    session = database.get_session()
    docker = session.query(projectProfile).filter(projectProfile.ProjectKey == projectkey).one()
    docker.DockerProfile = dockerprofile
    docker.LastUpdateDate = datetime.now() 
    session.commit()
    session.close()
开发者ID:flsyaoair,项目名称:guirendcos,代码行数:7,代码来源:projectservice.py


示例7: employeeAdd

def employeeAdd(name,phone,webChat=None,birthday=None,address=None,password="changeme",**args):
    """
    Add Employee, the default password is 'changeme'. At the first login, we need to force change password
    """
    session=get_session()
    
    employee=Employee()
    
    employee.name=name
    employee.phone=phone
    employee.password=password
    if not webChat is None:
        employee.wchat=webChat
    if not birthday is None:
        employee.birthday=birthday
    if not address is None:
        employee.address=address
        
    for item in args:
        if hasattr(Employee, item):
            setattr(employee,item,args[item])
        else:
            raise "Employee Didn't have this property: " + item
    session.add(employee)
    session.commit()
    session.close()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:26,代码来源:employeeservice.py


示例8: update_yard

def update_yard(YardId,YardName,Galleryful,Usage,updater):
    session = database.get_session()
    session.query(Yard).filter(Yard.YardId == YardId).update({'YardName':YardName.strip(),'Galleryful':Galleryful,
                                                                    'Usage':Usage.strip(),'Modifier':updater,
                                                                    'LastUpdateDate':datetime.now()})
    session.commit()
    session.close()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:7,代码来源:venueservice.py


示例9: disable_user

def disable_user(user_id):
    session = database.get_session()

    user = session.query(UserProfile).filter(UserProfile.UserId == user_id).update({'Status':UserStatus.Disabled})

    session.commit()
    session.close()
开发者ID:flsyaoair,项目名称:guirendcos,代码行数:7,代码来源:userservice.py


示例10: update

def update(id,taskcasename,jmxname,threads,rampup,threadloop,scale):
#     taskcasename ='cc'
    session = database.get_session()

    task = session.query(TEST_TASK).filter(TEST_TASK.TestTaskId == id).update({'TaskCaseName':taskcasename,'JmxName':jmxname,'Threads':threads,'RampUp':rampup,'ThreadLoop':threadloop,'SCALE':scale})

    session.commit()
    session.close()
开发者ID:flsyaoair,项目名称:guirendcos,代码行数:8,代码来源:pressuretestservice.py


示例11: query_project

def query_project():
    session = database.get_session()
    project_list = session.query(project).all()
    session.commit()
    session.close()
    return project_list  
      
      
开发者ID:flsyaoair,项目名称:guirendcos,代码行数:6,代码来源:projectservice.py


示例12: update_yards

def update_yards(VenueId,datalist,updater):
    session = database.get_session()
    for e in datalist:
        session.query(Yard).filter(Yard.YardId == e[0]).update({'YardName':e[1].strip(),'Galleryful':int(e[2]),
                                                                    'Usage':e[3].strip(),'Modifier':updater,
                                                                    'LastUpdateDate':datetime.now()})
    session.commit()
    session.close()    
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:8,代码来源:venueservice.py


示例13: employeeQueryByRoleName

def employeeQueryByRoleName(key,offset=0,limit=10):
    seesion=get_session()
    roleID=roleservice.getIDByName(key)
    querys=seesion.query(Employee).filter(Employee.role==roleID)
    
    querys=querys.offset(offset)  
    querys=querys.limit(limit)
    return querys.all()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:8,代码来源:employeeservice.py


示例14: query_order

def query_order(page_no,page_size,order_by,current_user,PayMode=0,OrderType=0,PayStatus=0):
    session = database.get_session()
    subdata = session.query(Order).filter(Order.Operator == current_user).filter(Order.PayMode == PayMode).filter(Order.OrderType == OrderType).filter(Order.PayStatus == PayStatus).all()
    subdata_list = []
    for i in subdata:
        subdata_list.append(i[0])    
    (data,row_count,page_count,page_no) = database.query_more(subdata,order_by,page_no,page_size)
    session.close()
    return (data,subdata_list,row_count,page_count,page_no)
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:orderservice.py


示例15: memberGetByID

def memberGetByID(employId):
    """
    Query member by name,phone,wehchat. it could be used for page when using offset,limit. Default is return first 10
    """
    seesion=get_session()
    querys=seesion.query(Member).filter(Member.id==employId)
    member=querys.first()
    seesion.close()
    return member
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:memberservice.py


示例16: memberFuzzyQuery

def memberFuzzyQuery(key,offset=0,limit=10):
    seesion=get_session()
    querys=seesion.query(Member)
    querys=querys.filter(or_(Member.name.like("%"+key+"%"),Member.phone.like("%"+key+"%"),Member.wchat.like("%"+key+"%")))

    
    querys=querys.offset(offset)  
    querys=querys.limit(limit)
    return querys.all()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:memberservice.py


示例17: query

def query(page_no,page_size,order_by,current_user):
    session = database.get_session()
    subdata = session.query(Venue).filter(Venue.Creator == current_user).all()
    subdata_list = []
    for i in subdata:
        subdata_list.append(i[0])    
    (data,row_count,page_count,page_no) = database.query_more(subdata,order_by,page_no,page_size)
    session.close()
    return (data,subdata_list,row_count,page_count,page_no)
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:venueservice.py


示例18: employeeGetByName

def employeeGetByName(employName):
    """
    Query employee by name,phone,wehchat. it could be used for page when using offset,limit. Default is return first 10
    """
    seesion=get_session()
    querys=seesion.query(Employee).filter(Employee.name==employName)
    employee=querys.first()
    seesion.close()
    return employee
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:employeeservice.py


示例19: employeeFuzzyQuery

def employeeFuzzyQuery(key,offset=0,limit=10):
    seesion=get_session()
    querys=seesion.query(Employee)
    querys=querys.filter(or_(Employee.name.like("%"+key+"%"),Employee.phone.like("%"+key+"%"),Employee.wchat.like("%"+key+"%")))

    
    querys=querys.offset(offset)  
    querys=querys.limit(limit)
    return querys.all()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:employeeservice.py


示例20: delete

def delete(VenueId):
    session = database.get_session()
    #先删除所属场地
    session.query(Yard).filter(Yard.Venue == VenueId).delete(synchronize_session=False)
    session.commit() # or session.expire_all()
    #再删除场馆
    session.query(Venue).filter(Venue.VenueId == VenueId).delete()
    session.commit()
    session.close()
开发者ID:guirenkeji,项目名称:fitnessPlatform,代码行数:9,代码来源:venueservice.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python user.User类代码示例发布时间:2022-05-27
下一篇:
Python alert.Alert类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap