Tables created with Peewee seem to disappear into thin air Tables created with Peewee seem to disappear into thin air flask flask

Tables created with Peewee seem to disappear into thin air


Turns out that this is a sublety of peewee's autocommit behavior. If autocommit is set to False, then any database created, will only be accessible within the active database commit. Thus, if you create the databases when the module is imported.

Adding db.commit() to the end of the create_table sequence seems to fix this problem.

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