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

2015-08-24 Thread Alex Fraser
Hi Michael, On Monday, 24 August 2015 12:31:20 UTC+10, Michael Bayer wrote: yes and no. Yes, if there's no added history, that should be skipped as you're doing, but no in that that particular line of code is not called if an object is being saved for the first time, only on an update, and

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

2015-08-24 Thread Mike Bayer
On 8/24/15 10:15 AM, Alex Fraser wrote: Hi Michael, On Monday, 24 August 2015 12:31:20 UTC+10, Michael Bayer wrote: yes and no. Yes, if there's no added history, that should be skipped as you're doing, but no in that that particular line of code is not called if an object is

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

2015-08-24 Thread Jonathan Vanasco
If you're using Postgres, you actually wouldn't even need to use a partial index if you can save NULL values instead of empty strings -- a unique constraint would work as intended because Postgres does not compare NULL values to one another. -- You received this message because you are

Re: [sqlalchemy] converting date @ hybrid property

2015-08-24 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

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

2015-08-24 Thread Alex Fraser
Hi Mike, On Tuesday, 25 August 2015 00:56:03 UTC+10, Michael Bayer wrote: great, thank you, these issues are both repaired as of d57e5edbcdf915168c613, the diff for his section is: Thanks very much! That works perfectly. By the way, you asked if I had changed *history_meta.py* at all: I

[sqlalchemy] history_meta.py: foreign keys in history table, and relationships

2015-08-24 Thread Alex Fraser
Hi Mike, Thanks for your help with my other problem. I have a couple of other questions / a wishlist: Is there a declarative way to add foreign keys to the history table when using history_meta.py? In the app I'm making the user can view old versions of a document, and I want to make sure

[sqlalchemy] mapper_configured event, class fully configured?

2015-08-24 Thread Douglas Russell
Hi again, I'm trying to track an issue making use of Marshmallow-SQLAlchemy (I've also seen what looks like a very similar problem in ColanderAlchemy, but I haven't dug into that yet). I think it might have something to do with the mapper_configured event and whether the class is truly fully

Re: [sqlalchemy] mapper_configured event, class fully configured?

2015-08-24 Thread Mike Bayer
On 8/24/15 9:21 PM, Mike Bayer wrote: On 8/24/15 7:41 PM, Douglas Russell wrote: | def print_stuff(mapper, class_): print getattr(class_, 'books') event.listen(mapper, 'mapper_configured', print_stuff) author = Author(name='Chuck Paluhniuk') | When I run this code, the result is

Re: [sqlalchemy] mapper_configured event, class fully configured?

2015-08-24 Thread Mike Bayer
On 8/24/15 7:41 PM, Douglas Russell wrote: | def print_stuff(mapper, class_): print getattr(class_, 'books') event.listen(mapper, 'mapper_configured', print_stuff) author = Author(name='Chuck Paluhniuk') | When I run this code, the result is that when Author is first used, the