-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't pickle GeoAlchemy PostGIS objects #24
Comments
Simple patch to fix:
|
I have the same problem while using pylibmc to cache objects which have geometry columns. The pylibmc library uses pickle internally to serialize/deserialize objects. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Title says it all.
If you attempt something like:
objects = session.query(MyGeoObject).all()
pickle.dumps(objects)
You'll get :
TypeError: can't pickle buffer objects
The problem is that PostGIS returns a Buffer object for geometry columns, which pickle can't handle.
A quick fix is to convert the Buffer into a string so the objects are serializable by Pickle. This does make a copy of the returned object, but I don't think that's avoidable.
This probably applies to other database that return non-pickleable types for geometry columns, and the fix is probably similar, but I don't have access to any other databases to debug on.
The text was updated successfully, but these errors were encountered: