File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from django .core .management .base import BaseCommand
22from django .db .models .expressions import RawSQL
33from osf .models import OSFUser
4+ from datetime import datetime
5+ import logging
6+
7+ logger = logging .getLogger (__name__ )
48
59
610def remove_orcid_from_user_social ():
7- OSFUser .objects .filter (social__has_key = 'orcid' ).update (social = RawSQL ("""social #- '{orcid}'""" , []))
11+ start = datetime .now ()
12+ orcid_records = OSFUser .objects .filter (social__has_key = 'orcid' )
13+ logger .info (f'extracted orcid records count { orcid_records .count ()} ' )
14+ deleted_records = orcid_records .update (social = RawSQL ("""social #- '{orcid}'""" , []))
15+ logger .info (f'deleted orcid records count { deleted_records } in { datetime .now () - start } ' )
816
917
1018class Command (BaseCommand ):
1119 def handle (self , * args , ** kwargs ):
12- breakpoint ()
1320 remove_orcid_from_user_social ()
You can’t perform that action at this time.
0 commit comments