Efficient way to access a mapping of identifiers in Python
        Posted  
        
            by sixbelo
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by sixbelo
        
        
        
        Published on 2010-06-05T12:08:49Z
        Indexed on 
            2010/06/05
            12:12 UTC
        
        
        Read the original article
        Hit count: 220
        
I am writing an app to do a file conversion and part of that is replacing old account numbers with a new account numbers.
Right now I have a CSV file mapping the old and new account numbers with around 30K records. I read this in and store it as dict and when writing the new file grab the new account from the dict by key.
My question is what is the best way to do this if the CSV file increases to 100K+ records?
Would it be more efficient to convert the account mappings from a CSV to a sqlite database rather than storing them as a dict in memory?
© Stack Overflow or respective owner