Re: [sqlalchemy] converting date @ hybrid property

2015-08-23 Thread Mehdi
After reading more documents i ended up using comparator for my hybrid property instead of expression. like: class JalaliDateComparator(Comparator): def operate(self, op, other): input_date = self.__clause_element__() g_date = other.togregorian() return op(input_d

Re: [sqlalchemy] converting date @ hybrid property

2015-08-23 Thread Mike Bayer
On 8/22/15 4:30 PM, Mehdi wrote: Hi I'm using latest sqlalchemy with an Oracle db backend. I have a Date column which presents a /Gregorian date/ in db. but i want to query my table by a /Jalali date/. So the hybrid_property to convert gregorian date into jalali date should be like this, i thi

Re: [sqlalchemy] Is it possible to set the constraint unique = True except for empty string into SQLAlchemy?

2015-08-23 Thread Mike Bayer
On 8/22/15 5:33 PM, Andriy Andrusyk wrote: I use the following column in my table: |email =Column(String(60),unique=True) | However, I need the possibility to save empty strings in this column. Namely, I need something like this: |email =Column(String(60),unique=True,blank=Tru

Re: [sqlalchemy] history_meta.py: IndexError when creating a new object

2015-08-23 Thread Mike Bayer
On 8/23/15 8:17 AM, Alex Fraser wrote: I'm using the separate table versioning code from /history_meta.py/. When I try to save a new object, I get this: | [...] File"/usr/local/lib/python3.4/dist-packages/sqlalchemy/orm/session.py",line 1282,in_autoflush self.flush() File"/usr/local/lib/pyt

[sqlalchemy] history_meta.py: IndexError when creating a new object

2015-08-23 Thread Alex Fraser
I'm using the separate table versioning code from *history_meta.py*. When I try to save a new object, I get this: [...] File "/usr/local/lib/python3.4/dist-packages/sqlalchemy/orm/session.py", line 1282, in _autoflush self.flush() File "/usr/local/lib/python3.4/dist-packages/sqlalchemy/o