More of a design question, complicated by the fact that I'm a  
database neophyte (although I've used SA a fair bit).

I have a web application that with periodically connect to a  
database. I've written a wrapper for the db using SQLalchemy, but I'm  
unsure about the best way to use the mapped classes. In some cases  
the client will fetch records (mapped classes) from the database and  
immediately use and then dispose of them. No problems. In other  
cases, it will keep those fetched objects around indefinitely,  
perhaps late changing them and sending them back. In even other  
cases, it might create instances of those objects independently of  
the db, and use them, maybe checking them in. Put as a use case:

"A Sample may be created by the web application or fetched from the  
database. Later on, it may be disposed of, edited or checked back  
into the db."

So, the design question is should the mapped (database) object  
classes be the same as the extra-db classes? On one hand, it's a lot  
simpler to have a single class Sample, rather than SampleRow (the  
mapped class) and SampleData (an unmapped, extra-db class). On the  
other hand, the requirements and coding of both classes are kinda  
different, and I find myself changing the properties of the mapped  
class for better mapping and making the use of the class in non-Db  
contexts more awkward. Also, the SA magic has made debugging of some  
non-Db issues quite difficult. Opinions or issues to consider.

--
Dr Paul-Michael Agapow: VieDigitale / Inst. for Animal Health
[EMAIL PROTECTED] / [EMAIL PROTECTED]




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

Reply via email to