1. Список говнокодов пользователя gofffno

    Всего: 1

  2. Python / Говнокод #21466

    −21

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    local_db_session.query(Account).filter(
    	Account.id == acc.id).update({
    	    'account_name': post_args['account_name']
    	    if 'account_name' in post_args and
    	    post_args['account_name'] else acc.account_name,
    	    'account_class': post_args['account_class']
    	    if 'account_class' in post_args and
    	    post_args['account_class'] else acc.account_class,
    	    'remaining_search_count':
    	    post_args['remaining_search_count']
    	    if 'remaining_search_count' in post_args and
    	    post_args['remaining_search_count'] else
    	    acc.remaining_search_count,
    	    'remaining_save_count': post_args['remaining_save_count']
    	    if 'remaining_save_count' in post_args and
    	    post_args['remaining_save_count'] else
    	    acc.remaining_save_count,
    	    'remaining_view_count': post_args['remaining_view_count']
    	    if 'remaining_view_count' in post_args and
    	    post_args['remaining_view_count'] else
    	    acc.remaining_view_count,
    	    'remaining_roll_times': post_args['remaining_roll_times']
    	    if 'remaining_roll_times' in post_args and
    	    post_args['remaining_roll_times'] else
    	    acc.remaining_roll_times,
    	})
    local_db_session.commit()

    оптимизация апдейта с помощью sqlalchemy

    gofffno, 17 Октября 2016

    Комментарии (6)