On Fri, May 8, 2009 at 12:17 PM, Álvaro Justen [Turicas] <
[email protected]> wrote:

>
> On Fri, May 8, 2009 at 2:12 PM, Yarko Tymciurak <[email protected]> wrote:
> > you might look at some of the backend code that sqalchemy uses to
> accomplish this...
> > See: http://www.sqlalchemy.org/docs/05/metadata.html#reflecting-tables
> > Which will lead you to (in lib/sqlalchemy/schema.py) to
> MetaData.reflect() ==> Table.__init__() ==> reflecttable();
> > Many defined per specific db's (see lib/sqlalchemy/databases);
> reflecttable() seems to be dispatched from lib/sqlalchemy/engine/base.py,
> and digested in lib/sqlalchemy/databases.information_schema.py.
> > Hopefully, the SQL in the reflecttable() of the individual database files
> will be helpful for starters.
>
> Thanks, Yarko. I'll see it later.
> For now I'm using SQL_DIALECTS to map reversed: "database language" to
> "web2py language" (example: 'string' -> 'CHAR(32)' in SQLite). It is
> working.
> The really "hard" work is to get table list and table fields (and
> types) from DB.
>

Ok, great.

Besides having done the backend work for this already,  one thing I
particularly like about the way Sqlalchemy set this up is being able to say
something which would look like (in web2py):
db.define_table('some_existing_table', autoload=true) ....

This concept I like - autoload == reflect the table, and implies
migrate=False.

As long as we go in this direction, if we add to this recognition of _any_
primary key which is an index, we should be able to map this internally in
web2py --- this combination would be really useful I think.

Thank you Alvaro!

Regards,
- Yarko

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
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