Yes.

db.define_table('tablename',...fields....,migrate=False)

as long as
1) tablename exists
2) fields is a subset of the actual fields (you do not need to list
all fields, only those you need to access)
3) tablename has a field called "id" which is an int autoincrement
primary key

you can access it.


On Oct 28, 8:22 am, Stan <[EMAIL PROTECTED]> wrote:
> So you are saying that web2py will 'attach' to views in the same way
> as tables(migrate=false), as long as the fields in the views match the
> table criteria?  That sounds very promising to enable connection to
> complex preexisting schemas.
>
> On Oct 22, 10:38 am, "Yarko T" <[EMAIL PROTECTED]> wrote:
>
> > then web2py will not be able to manage that database using DAL - you _can_
> > execute SQL directly using web2py's executesql()  call, but...
> > If you do not want to change your database, but want to be able to work with
> > it, if your database server provides "views", you can use this method to
> > re-name "user_id" to "id" etc. for your application, that is build a custom
> > view into the existing database.
>
> > On Wed, Oct 22, 2008 at 9:24 AM, JorgeRpo <[EMAIL PROTECTED]> wrote:
>
> > > what if this  column in the pre-existing table is called 'user_id' or
> > > 'item_id'?
>
> > > On Oct 21, 12:15 pm, "Yarko T" <[EMAIL PROTECTED]> wrote:
> > > > One more thing:  each table in your existing database schema must have a
> > > > unique, auto-incrementing field called "id".   If your database does not
> > > > follow this form, you will need to alter it to add such a field.
>
> > > > This is one constraint that web2py imposes.
>
> > > > Also,  my previous response should have used the keyword 'False, i.e.
> > > > "....db.table(......, migrate=False)"
>
> > > > On Tue, Oct 21, 2008 at 11:59 AM, Yarko T <[EMAIL PROTECTED]> wrote:
> > > > > You can define a table with "migrate=false" parameter;
>
> > > > > For xxxx.define_table(), you only need to define those things that 
> > > > > your
> > > > > web2py applicaiton need to know about - basically, you're defining the
> > > > > interface to the database that you want to have.   Turning off
> > > migrations
> > > > > keeps from generating the SQL code to update the table schema.
>
> > > > > Hope this helps.
>
> > > > > Yarko
>
> > > > > On Tue, Oct 21, 2008 at 11:27 AM, [EMAIL PROTECTED] <
> > > [EMAIL PROTECTED]
> > > > > > wrote:
>
> > > > >> Can web2py's DAL be used without migrations?  If I have a 
> > > > >> pre-existing
> > > > >> database schema, is there a way around using db.define_table?  I've
> > > > >> done this with rails by just using empty models.
>
> > > > >> Thanks.- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to