I am starting with Flask sqlalchemy, but i don't understand how works the demo of the homepage (here).
This will create the structure:
>>> from yourapplication import db
>>> db.create_all()
But I don't understand where these users are stored.
>>> from yourapplication import User
>>> admin = User('admin', '[email protected]')
>>> guest = User('guest', '[email protected]')
>>> db.session.add(admin)
>>> db.session.add(guest)
>>> db.session.commit()
Because if I do Select * from user;
I will get:
test=# \dt
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | user | table | postgres
(1 row)
test=# select * from user;
current_user
--------------
postgres
(1 row)
However the output is the expected:
>>> users = User.query.all()
>>> [<User u'admin'>, <User u'guest'>]
So, what is happening here? the users are stored in cache? memory? Because i don't see any admin or guest in the user table .
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db')