3.1 Data Modelling

Ankur Pandey
2 min readJun 26, 2017

--

The first task of the third week of Hasura internship is to create data models for the web app and adding relevant tables to the project.

Data Modelling

Data modelling is the process of documenting and analysis of data objects and their relationships to other data objects as an easily understood diagram.

Data model
The term data model actually refers to two very different things: a description of data structure and the way data are organized using, for example, a database management system.

Three levels of Data Modelling
conceptual data model, logical data model, and physical data model

Comparison between different levels

Tool used: PonyORM
object-relational mapper (ORM ) wraps your tables or stored procedures in classes in your programming language, so that instead of writing SQL statements to interact with your database, you use methods and properties of objects.
PonyORM is a library for Python language that allow to work with objects which are stored as row in relational table.

Benefits of ORM:
1. Allow you to more easily support more database engines.
2.you can focus on writing the logic, instead of getting all the SQL right. The code will typically be more readable as well, since it doesn’t contain all the “plumbing” necessary to talk to the database.

My Data Model:

Data Model created using Editing diagram of PonyORM

DBMS used: PostgreSQL

How Data Model is going to affect major screens:

Screen 1 (Enter Marks): Marks entered by admin is stored in the Result table. Before entering marks of a particular roll number , it should have an entry in User_Info table (Foreign key constraint), so student need to registered first before it become eligible for getting result.

Screen 2 (Display Marks): Marks are retrieved from Result table and populated on the table displayed on the browser. The result will be displayed for those students whose marks are entered by the authorized admin.

Screen 3 (Graphical analysis): candidate’s Marks (whose id is entered), average marks, highest marks and marks within different ranges are retrieved from Result table, calculations are done and graphical analysis is performed to generate the appropriate suggestions for improving the performance.

Description of tables:-
User_Info table
Primary Key: id
Insert permission: anyone
Select permission: anyone
Result table
Primary Key: id
Foreign Key: id
Insert permission: admin
Select permission: anyone

Useful Links:

Next: 3.2 Hasura Data API

--

--