OK, the usage pattern there is incorrect. Create a Table/Mapper at the module level at the same level in which you create your classes. To make this easier, look into using the declarative extension: http://www.sqlalchemy.org/docs/04/plugins.html#plugins_declarative ...that way there's no chance of your class not being in sync with a single mapper(). It's not supported to create an instance of an object, *then* create the mappers. The class needs to be mapped for the lifespan of all instances.
On May 31, 2008, at 10:43 AM, sniffer wrote: > > Hi michael, > thanks for the reply i am trying it in an extremly small script the > code is mentioned below > > def logsync(self): > entity="testq" > self.__sqlorm__dblogger.info("Current Entity -" + entity) > importcmd="from dbmod.%s import %s as entitymodule" % > (entity,entity+"class") > exec(importcmd) > logobj=entitymodule() > logobj.field1="www" > self.__sqlorm__dbsessionobj=self.__sqlorm__dbsessionwrap() > tblobj=self._createtblobj(entity)--------------> table object > created using reflection > mapper(entitymodule,tblobj) > try: > self.__sqlorm__dbsessionobj.save(logobj) > self.__sqlorm__dbsessionobj.commit() > self.__sqlorm__dbsessionobj.close() > clear_mappers() > except Exception,ex: > self.__sqlorm__dblogger.info(str(ex)) > clear_mappers() > return False > return True > > when u say smaller script how small do you mean and as always any > pointers are highly appreciated > > TIA > > On May 31, 6:36 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: >> On May 31, 2008, at 4:09 AM, sniffer wrote: >> >> >> >>> hi all, >> >>> first of all thank u guys for all ur help on my previous posts. >>> This time around i again have a table in an mssql db, the table has >>> just 2 fields one int field(PK) and the other a varchar field. >>> the table object for the table in question is auto generated, the >>> problem is that when i save the an object and finally commit it i >>> get >>> the following error 'ColumnProperty object has no attribute key'. >> >>> what could i be doing wrong any help will be highly appreciated. >> >> sounds like uncompiled mappers, which sounds maybe like you are >> squashing an error raised during mapper compile. try to reproduce >> the behavior in a small script. > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---