Michael Hipp wrote:

> And I have a record like this where the fields are populated and
> it has been saved in the database:
>
> full = MyThing(name="Foo", blah, blah)
>
> If I want to "empty" that record to convert it to look like:
>
> empty = MyThing()
>
> Where no fields are populated, can I just do something simplistic
> like this? [snip snip] Or is there some more elegant way to empty
> a record?

I am not exactly sure why you would want to do this, and I
definitely don't understand your proposed solution.  If a row is
empty (apart obviously from its primary key), you might as well just
delete it, no?

Anyway, if you *do* decide that you really want to clear a row out
apart from its primary key, so that it shows up when you query for
results, but is basically empty, then you can iterate through the
non-primary-key columns, and set their value to None, which will
null out those values in the database.

Again, I don't really see the point, but this is what you'd want to
do :)

--
Jonathan LaCour
http://cleverdevil.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to