** This is incomplete and to be considered a proof of concept **

1) download
http://groups.google.com/group/web2py/web/sqlalchemy.py

2) import it in your app and try the following model:

    db=SQLDB()
    metadata=MetaData(db)

    users = Table('users', metadata,
       Column('id', Integer),
       Column('name', String(40)),
       Column('age', Integer),
       Column('password', String),
       Column('blob1',Binary),
    )

    dogs = Table('dogs', metadata,
       Column('id', Integer),
       Column('name', String(40)),
       Column('owner', ForeignKey('users.id')),
    )

    print users.fields
    print dogs.fields

3) click on [database administration] to see the generated interface.

As in the Django cases, the above code defines tables 'users' and
'dogs'. They are web2py tables so you can do:

id=users.insert(name='Test')
dogs.insert(name='Snoopy',owner=id)
for row in db(dogs.owner==users.id).select(): print
row.dogs.name,row.users.name

Massimo
--~--~---------~--~----~------------~-------~--~----~
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