On Fri, Mar 04, 2011 at 12:49:50PM +0000, Timothy W. Grove wrote:
> It seems to me that there should be a simple way to add the attribute to  
> the class if the column has been added already, or not if it has been  
> added through updating

   There is no a simple way. You have to create the table class without
the column, and then look into the database to determine if the column
is there. You can use the same mechanism SQLObject uses to implement
fromDatabase: connection.columnsFromSchema(tableName, soClass); the
result is a list of SOCol instances.

> I've also experimented with reading the class description from the  
> database using "class sqlmeta: fromDatabase = True" but I don't think  
> this works with the sqlite backend.

   Well, database introspection can't be precise; for example, SQLObject
cannot determine on per-column basis if you want StringCol or
UnicodeCol. SQLObject's implementation is also quite simple, it cannot
determine ForeignKeys, e.g. But it can get the list of columns with
their types. Do you have problems with that?

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            p...@phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to