I am running `define_tables` in the recommended way:

    db = DAL('postgres://user:XXXX@localhost:5432/mydb', 
migrate_enabled=False, auto_import=False, lazy_tables=True)
    db.define_table('auth_user',
        Field('email', unique=True),
        Field('password', length=512, type='password', readable=False, 
label='Password'),
        ...)

This gets executed without errors, but no table is created in the database. 
Whenever I try to insert a new user:

    relation "auth_user" does not exist

What can be going on? Once the tables are created (manually, for example), 
the application works fine. I am using a postgres backend. This happens no 
matter what value I give to `lazy_tables`

EDIT
----

This is the full test script:

    from gluon import DAL
    from gluon import Field
    
    db = DAL('postgres://user:pass@localhost:5432/mydb', 
migrate_enabled=False)
    
    db.define_table(
        'auth_user',
        Field('email',              type='string', unique=True),
        Field('password',           type='password'),
        Field('registration_key',   type='string',   length=512, 
writable=False, readable=False, default=''),
        Field('reset_password_key', type='string',   length=512, 
writable=False, readable=False, default=''),
        Field('registration_id',    type='string',   length=512, 
writable=False, readable=False, default=''),
    )
    db.commit()
    
    print db.tables
    
    db.auth_user.insert(email='g@b.c')

And I get the following output:

    ['auth_user']
    Traceback (most recent call last):
      File "xxx.py", line 19, in <module>
        db.auth_user.insert(email='g@b.c')
      File "/tmp/web2py/gluon/dal.py", line 9293, in insert
        ret =  self._db._adapter.insert(self, self._listify(fields))
      File "/tmp/web2py/gluon/dal.py", line 1361, in insert
        raise e
    psycopg2.ProgrammingError: relation "auth_user" does not exist
    LINE 1: INSERT INTO auth_user(reset_password_key,registration_id,reg...

The table is somehow "created" (in memory?), but it is not really in the 
postgres database. What does this mean?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to