On Jan 14, 2011, at 3:04 PM, A.M. wrote: > > On Jan 13, 2011, at 3:29 PM, Michael Bayer wrote: > >> There's mistakes in how this is structured. UserDefinedType represents a >> type object applied to a Column. The actual data handled by such a type is >> not meant to be an instance of the type itself. ACLItem() here would be its >> own class, and UserDefinedType would be the superclass of a class like >> "ACLItemType". ACLItemType() is placed on the Column, and its >> bind_processor() and result_processor() deal with ACLItem objects. >> >> Once you have the roles of "type" and "value" set up, you'd want to mixin >> sqlalchemy.types.MutableType, which alerts the ORM that the value of this >> type can change "inline". Note that MutableType is not recommended for high >> volume applications as it performs terribly, due to the need for flush() to >> scan all "mutables" in the session for changes every time it's called - 0.7 >> has a new extension that allows mutable values to send change events in an >> efficient manner. > > Thank you for the detailed response! > > I have implemented all of your advice, but have hit another roadblock- > specifically, I cannot determine how to properly cast the array type from > within the ACLItemArrayType class. > > ....../sqlalchemy/engine/default.py", line 299, in do_execute > cursor.execute(statement, parameters) > ProgrammingError: (ProgrammingError) column "aclarray" is of type aclitem[] > but expression is of type text[] > LINE 1: INSERT INTO imageaclarray (aclarray) VALUES (ARRAY[E'user te... >
I suspect I have to implement special converter methods with psycopg2 register_adapter/new_type. That is what I am experimenting with now. Cheers, M -- 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 sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.