Massimo,

I think the idea work best is adapt the database to work with web2py.
Some time ago I post a kind of workflow to it:

1.Define a connection
2. List all databases*
3. choose a database
4 List all tables of database.
5. choose the *tables* to work
6.list all fields of choosen tables
7 auto-detect field relationships
8 manually define field relationships
9 check for necessary requirements for DAL and suggest solutions; the
  user choose the most appropriate solution and apply.
  (for me, solutions are only: create or rename the necessary field,
  especially id, would be could if DAL could accept declare a existent
  autoincrement field as id, while this real name is not. A possible
solution
  is Postgresql is create a view redeclaring the name the field = my_id as
  id.  )
10 DAL, as almost every orm, have a limited subset of fieldtypes, for
compatibility for all databases. If a existent database have a non-standard
DAL's fieldtype, is necessary define a solution how treat the data. So is
necessary define a kind of conversion routine reading and writing for every
non-standart fieldtype. The wizard would sugest some options or let the user

define their own code.
11. Finally, everything checked, generates the db model, including
migrate=False.


The above workflow could be a "Complete" solution.
I think in a more simple way to implement:

1.the user generate a sql schema with database tool
2. a python script "read" the sql schema, check for necessary requirements
for DAL and write a second sql schema(*a)with the necessary "alter"'s to
database and web2py db model(*b), including migrate=false.
3. the user aply the second schema (*a) to database and put the model(*b) in
web2py.



2009/7/24 mdipierro <mdipie...@cs.depaul.edu>

>
> This functionality could be included in the new DAl but there is a
> workflow issue perhaps you can help me brainstorm it and resolve it.
>
> If we do, web2py will have three source of information that may be
> conflicting:
> 1) the table description from the model
> 2) the table description from the metadata
> 3) the table description as surrently in DB
>
> without 3) web2oy assume that 1) overrides 2) and eventually does a
> migration. If we have 3 sources of conflicting information how do we
> decide which action to take (migrate? how? what is right?). To me the
> workflow become nontrivial and may not be obvious what needs to be
> done.
>
> Massimo
>
> On Jul 24, 2:03 am, Boriel <bor...@gmail.com> wrote:
> > The script I sent several days ago is about that, but at the moment it
> only
> > accepts mysql databases.
> > I'll be working on it the next week.
> >
> > Regards,
> > Boriel
> >
> >
> >
> > On Fri, Jul 24, 2009 at 07:51, Hans Donner <hans.don...@pobox.com>
> wrote:
> >
> > > I think this would be a perfect tool for a web2py toolkit (seperate
> > > from the main web2py).
> >
> > > On Fri, Jul 24, 2009 at 05:38, Alexandre
> > > Andrade<alexandrema...@gmail.com> wrote:
> > > > Leandro,
> >
> > > > I announced some time ago start in a script/aplication in web2py to
> do
> > > that
> > > > with postgresql. But since them I have so many projects, and could
> not
> > > > advanced.
> >
> > > > I posted a roadmap to do that too. (search for my posts at google
> > > groups).
> >
> > > > What database you use?
> >
> > > > Mail me in private email to talk about this.
> >
> > > > 2009/7/23 Leandro - ProfessionalIT <lsever...@gmail.com>
> >
> > > >> Hi,
> > > >>  It's possible import a SQL Schemma Database into a model.py ?
> >
> > > >>  I have a big legacy database(with many tables) and I want generate
> > > >> the model class from database( If this possbile !).
> >
> > > >>  Any idea ?
> >
> > > > --
> > > > Atenciosamente
> >
> > > > --
> > > > =========================
> > > > Alexandre Andrade
> > > > Hipercenter.com
> >
> > --
> > Boriel      http://www.boriel.com
> >
>


-- 
Atenciosamente

-- 
=========================
Alexandre Andrade
Hipercenter.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to