[sqlalchemy] ColumnProperty object has no attribute key
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. TIA --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: sqlite PK autoincrement not working when you do a composite PK?
On May 31, 2008, at 12:38 AM, Russell Warren wrote: I've tried sifting through the sqlite dialect to figure out what is going on and have even tried forcing supports_pk_autoincrement to be true, but it rapidly became clear I hadn't a clue what I was doing in the sqlalchemy guts. Does anyone know why autoincrement on id stopped working, and how I can fix it? this is not a SQLA behavior, its a known behavior of sqlite3 - its autoincrement feature ceases to work with a composite primary key. I've never known any workaround for it (with the possible exception of declaring the second column in the PK as unique, instead of it actually being part of the PK). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: ColumnProperty object has no attribute key
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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: ColumnProperty object has no attribute key
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 -~--~~~~--~~--~--~---
[sqlalchemy] Re: ColumnProperty object has no attribute key
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 -~--~~~~--~~--~--~---