0.3.12
+- sql
+ - func. objects can be pickled/unpickled [ticket:844]
- orm
- query.get() and related functions (like many-to-one lazyloading)
generate randomly-generated bind parameter names, to prevent
return self.elem._hide_froms()
def _get_from_objects(self):
return self.elem._get_from_objects()
+
def __getattr__(self, attr):
return getattr(self.elem, attr)
+
+ def __getstate__(self):
+ return {'elem':self.elem, 'type':self.type}
+
+ def __setstate__(self, state):
+ self.elem = state['elem']
+ self.type = state['type']
class _Label(ColumnElement):
"""represent a label, as typically applied to any column-level element
from sqlalchemy import *
from sqlalchemy.databases import sqlite, postgres, mysql, oracle, firebird, mssql
import unittest, re, operator
-
+import pickle
# the select test now tests almost completely with TableClause/ColumnClause objects,
# which are free-roaming table/column objects not attached to any database.
# test None becomes NULL
self.runtest(func.my_func(1,2,None,3), "my_func(:my_func, :my_func_1, NULL, :my_func_2)")
+ # test pickling
+ self.runtest(pickle.loads(pickle.dumps(func.my_func(1, 2, None, 3))), "my_func(:my_func, :my_func_1, NULL, :my_func_2)")
+
def testextract(self):
"""test the EXTRACT function"""
self.runtest(select([extract("month", table3.c.otherstuff)]), "SELECT extract(month FROM thirdtable.otherstuff) FROM thirdtable")