Api pour ma gestion d'un dossier médical sous Apistar
- License : GNU General Public License v3
- Documentation: https://mapistar.readthedocs.org/en/latest/
- Source: https://github.com/jgirardet/mapistar
- TODO
- TODO
class Customer(db.Entity):
id = PrimaryKey(int, auto=True)
email = Required(str)
@db_session
def handler(email):
c = Customer(email=email)
# c.id is equal to None
# because it is not assigned by the database yet
c.flush()
# c is saved as a table row to the database.
# c.id has the value now
print(c.id)
Note
When :pyflush
is called, the object is saved only inside the current session.
It means it will be peristed to the database after calling :pycommit
manually (not necessary in most cases) or automatically before leaving the current database session.