Tables created with Peewee seem to disappear in the air

I am currently writing a flash application using peeweeorm for postgresql. This worked fine in the past, but it seems like something was confused, and I don’t understand how to proceed with debugging the problem.

First, I start the database as follows:

/usr/local/pgsql/bin/psql -D /usr/local/pgsql/data

I am creating a new database:

/usr/local/pgsql/bin/createdb indico

configure the connection as follows:

db = peewee.PostgresqlDatabase(
'indico',
host="/tmp/",
user = 'indico', # There is also an indico user, this is not a db name confusion
password = 'password',
)

Create the necessary tables:

class PostgresqlModel(peewee.Model):
    """A base model that will use our Postgresql database"""
    _id = peewee.PrimaryKeyField()

    class Meta:
        database = db
PostgresqlModel.create_table()

But then when I try to access the created tables:

/usr/local/pgsql/bin/psql -d indico -U indico
>>> \dt
no relations found

Nothing seems to be visible. If I try to create them again, I get an error message that already exists, and while I can save the objects, I cannot load them.

, - , , , . , - , .

+4
1

, peewee autocommit. autocommit False, . , .

db.commit() create_table, , .

if __name__ == "__main__":
    User.create_table()
    db.commit() 
-1

All Articles