File: customize-pickle-serialization

package info (click to toggle)
omnidb 3.0.3b%2Bds-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 34,260 kB
  • sloc: javascript: 439,909; python: 35,773; sh: 1,175; sql: 842; makefile: 28
file content (19 lines) | stat: -rw-r--r-- 638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- a/OmniDB/OmniDB_app/include/Spartacus/Database.py
+++ b/OmniDB/OmniDB_app/include/Spartacus/Database.py
@@ -1859,6 +1859,16 @@ class PostgreSQL(Generic):
             if not v_keep:
                 self.Close()
 
+    def __getstate__(self):
+        state = self.__dict__.copy()
+        # don't pickle 'v_special'
+        del state["v_special"]
+        return state
+
+    def __setstate__(self, state):
+        self.__dict__.update(state)
+        # add 'v_special' back since it doesn't exist in the pickle
+        self.v_special = PGSpecial()
 
 '''
 ------------------------------------------------------------------------