It looks like it might be easier to define a Table object using the view, specifying a PrimaryKeyConstraint and then using the mapper function to tie it to a class. Do you think this would work? Would I need to write a properties argument to the mapper?
Apologies if these are stupid questions. I've only just picked up SA (and I've got a deadline). I guess I could also just write a very thin ORM of my own, based on raw sql, since I'll be using only a fraction of the normal ORM functions... Just looking for path of least resistance. Thanks, J On Oct 24, 12:03 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Oct 24, 2008, at 11:41 AM, john.goodleaf wrote: > > > > > > > So here's the problem. I am faced with two legacy systems outside my > > control. One is SQL Server and the other is Oracle. In both only views > > are exposed to me and I don't anticipate that changing. > > > I'd like to map these views to objects. Of course, it's read-only so > > I'm not concerned with the other three CRUD ops; I just need to > > provide OO interfaces for downstream web apps. > > > I can connect to both through sqlalchemy but am having some trouble > > getting reflection to work. Oracle, in particular, complains that it > > can't find the views. I peeked into the oracle.py code and it appears > > to me that the reflection operations always refer to the all_tables > > entity. I presume something similar is going on in SQL Server. > > > So before I start mangling the SA code myself, I thought I'd check in > > to see whether someone has already solved these problems. Anyone? I'll > > be your best friend. > > the issue here is limited to reflection of views. and no, we haven't > implemented that in general. patches are of course welcome, but you > can also write your own custom reflector to meet your needs (i.e. > issue the SQL , build your own Table object programmatically using > table.add_column()). its pretty trivial. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---