Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6331561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:05:35+00:00 2026-05-24T18:05:35+00:00

I looked through several SO-Questions for how to pickle a python object and store

  • 0

I looked through several SO-Questions for how to pickle a python object and store it into a database. The information I collected is:

  • import pickle or import cpickle. Import the latter, if performance is an issue.
  • Assume dict is a python dictionary (or what so ever python object): pickled = pickle.dumps(dict).
  • store pickled into a MySQL BLOB Column using what so ever module to communicate with Database.
  • Get it out again. And use pickle.loads(pickled) to restore the python dictionary.

I just want to make sure I understood this right. Did I miss something critical? Are there sideeffects? Is it really that easy?

Background-Info: The only thing I want to do, is store Googlegeocoder-Responses, which are nested python dictionarys in my case. I am only using a little part of the response object and I don’t know if I will ever need more of it later on. That’s why I thought of storing the response to save me repetition of some million querys.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:05:37+00:00Added an answer on May 24, 2026 at 6:05 pm

    It’s really that easy… so long as you don’t need your DB to know anything about the dictionary. If you need any sort of structured data access to the contents of the dictionary, then you’re going to have to get more involved.

    Another gotcha might be what you intend to put in the dict. Python’s pickle serialization is quite intelligent and can handle most cases without any need for adding custom support. However, when it doesn’t work, it can be very difficult to understand what’s gone wrong. So if you can, restrict the contents of the dict to Python’s built-in types. If you start adding instances of custom classes, keep them to simple custom classes that don’t do any funny stuff with attribute storage or access. And beware of adding instances of classes or types from add-ons. In general, if you start running into hard-to-understand problems with the pickling or unpickling, look at the non-built-in types in the dict.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've looked through several other questions here and on other sites regarding this issue,
I've looked through several of the questions here and am not quite connecting all
I looked through the existing questions of this kind but didn't find what I
I looked through previous questions to this effect, but my situation is slightly different...
Reciently I've looked through several implementation of bitap algorithm but what all of them
I've looked at several similar questions but I didn't see any that directly applied
I have looked through several answers for loading CSS pages. http://docs.djangoproject.com/en/dev/howto/static-files/ Basically, I believe
I have looked at several of the other regular expressions questions here and on
I looked through the related questions, there were quite a few but I don't
I've looked through the various questions on unit testing but can't find one that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.