コード例 #1
0
def db_insert_application(application_list):
    session = DBSession()
    response = []
    for i in application_list:
        application = Application(name = i['name'], description = i['description'], identification = i['identification'])
        session.add(application)
        response.append(application)
        session.commit()
    return response
コード例 #2
0
def db_insert_character(character_list):
    session = DBSession()
    response = []
    for i in character_list:
        character = Character(name = i['name'], description = i['description'])
        session.add(character)
        response.append(character)
        session.commit()

    return response
コード例 #3
0
def db_insert_language(language_list):
    session = DBSession()
    response = []
    for i in language_list:
        language = Language(name=i['name'],
                            description=i['description'],
                            identification=i['identification'])
        session.add(language)
        response.append(language)
        session.commit()
    return response
コード例 #4
0
def db_insert_translation(translation_list):
    session = DBSession()
    response = []
    for param in translation_list:
        language_id = param['language_id']
        application_id = param['application_id']
        character_id = param['character_id']
        cha_translation = param['cha_translation']
        translation = Translation(language_id=language_id, application_id=application_id, \
                                  character_id=character_id, cha_translation=cha_translation)
        session.add(translation)
        response.append(translation)
    session.commit()
    return response