But how would you handle updates (views being read-only). --David
On Apr 1, 2:34 pm, Yarko Tymciurak <yark...@gmail.com> wrote: > On Wed, Apr 1, 2009 at 12:34 AM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > Can you create a custom database view and map the field? > > Yes - this is the way to do it in your db server. You also want to set your > web2py table definition to migrate=False (so that an ALTER TALE is not > attempted by web2py). NOTE: you only need to define (in web2py) the columns > you intend to access (not the entire table). Of course, you can do the same > in your VIEW when you create it. > > > > > On Apr 1, 12:06 am, Kevin Butler <kevinjbut...@gmail.com> wrote: > > > This was posted as a comment tohttp:// > > mdp.cti.depaul.edu/AlterEgo/default/show/55: > > > Which reads: > > > > > web2py can import tables saved in csv format therefore it can access > > legacy data. > > > > web2py can also access existing databases directly (MySQL, PostgreSQL, > > SQLite and Oracle) if > > > > each table has an auto increment field called "id" and if this is the > > field used for referencing. > > > > > Most legacy databases can be converted into the above format by using > > ALTER TABLE. If the legacy > > > > database cannot be converted into such format, it probably has design > > issues and should be > > > > reworked anyway. web2py tries to enforce good software engineering > > practice. HOWEVER, IN > > > > REALITY THIS IS UNREALISTIC AND IS A GREAT DRAWBACK IN ANY ATTEMPT TO > > USE > > > > WEB2PY ON LEGACY SYSTEMS. > > > > This really is inconvenient for legacy databases that are still in use > > > by other applications. > > > > In my case, I want to read and possibly modify a user table belonging > > > to a Dekiwiki installation, but because web2py will not be the > > > exclusive owner of the table, I can't alter the table to meet web2py's > > > requirements. > > > > The table has a "user_id" primary key, so if I could do something > > > like: > > > > db.define_table( "users", > > > ..., > > > id="user_id", > > > migrate=False > > > ) > > > > I'd be able to do use the web2py database layer, but as it is, I added > > > code to use MySQLdb directly. > > > > kb --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---