In this recipe, we will work with the persistent library, which has been designed to abstract the concept of defining the schema (the data models and the relationships between them), and working with a storage backend (such as SQLite, and PostgreSQL).
In this recipe, we will create a model to store the following data:
- User details (username, email)
- Stock that the user is interested in (exchange, symbol)
We will use SQLite as the backend, as it does not require any installation. But the model defined here can be worked out with any persistent backend, such as PostgreSQL. The model definition in the persistent library is created through Template Haskell. Template Haskell enables programmers to generate code at compile ...