On Sep 22, 2010, at 6:44 PM, Michael Hipp wrote:

> On 9/22/2010 5:24 PM, Michael Bayer wrote:
>> Here's the problem.  The term "a blank record" is meaningless.
> 
> Well, no, it's not. It's exactly what I get when I do new=Item() and 
> commit(). It's very well defined, precise, and repeatable.
> 
>> Trying to make other tools guess this for you seems to be taking up days of 
>> your time - whereas a simple def set_myself_blank(self) method OTOH would 
>> take 30 seconds.
> 
> I've been writing that 30 second method for 2 days now. So evidently it takes 
> longer than that :-)
> 
> Problem is that model has about 75 columns in it. Each Column() has a 
> default='foo' parameter. And they are all unique to some extent.
> 
> So I can *replicate* that information that is already there in a dict 
> somewhere that will have 75 lines in it and then maintain it in sync with the 
> "official" version. That is a severe violation of DRY and it will inevitably 
> lead to bugs and possibly data corruption.
> 
> Avoiding such seems a worthy goal.
> 
> I apologize, truly, that I have greatly overused your assistance on this. 
> Thank you.
> 
> I have formulated a couple of hackish approaches that will probably work. 
> Guess I'm stuck with them. :-)

I guess, even though you've never stated this very clearly, that "a blank 
record" means, you'd like the "default" value for all columns reset to the 
"default" ?   What if the "default" for a certain column is the current 
timestamp ?   How are you going to recreate that ?    Or somehting set by a 
sequence or other stored procedure where the original value is missing ?   You 
probably don't have this issue but the idea of "a blank record" is still 
something somewhat specific to your situation.

Anyway as I said, read through the columns on table.c and use 
default/server_default. 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to