-
Notifications
You must be signed in to change notification settings - Fork 0
Models and Schemas
CRAG666 edited this page Jun 22, 2020
·
8 revisions
Models are made with sqlalchemy(read for more info), the only change from sqlalchemy models is to create a method:
- changes
The models would look like this:
The changes method receives a json as a parameter:
Json key values are assigned to the columns of the database:
Take any action on the data, In the example the password is encrypted
The constructor receives as a parameter a json and call the changes method; this to avoid doing repetitive code
The changes method will serve to insert data in json format both to create a new record (init method) and to modify it (changes method)