Please, execute the following commands to execute the POC:
$ pip3 install -r requirements.txt.old # to install the required modules
$ . venv/bin/activate # loading of python venv
# Launching uvicorn
cd src/fastapi_poc
$ uvicorn main:app --port 10000 --reload
Access the documentation to check the enabled endpoints:
How easy is to connect, model each table's fields, and operate an existing Postgres database.
How easy is to create the schemas that will expose the intended fields through the different endpoints
The OCC will be achieved checking the version
variable on the database before committing the changes. If the version
values doesn't match, someone has update this db register before.
Each time an update database operation is executed, report through a websocket channel events
notifying with a json
report that includes the changes
{
project: 13,
object {
obj_type: 'userstory',
obj_id: 118,
action: 'update'
}
}
Each time is performed an update database operation, a change report should also be stored in database (Postgres / Redis / mongodb).
A simple version about this, could be to store the previous version of the object (with the old values), and the new version of the object (including the new values)
With this approach, it should be stored in the database a json serialization of the object, before the change and after:
{
operation_date: "2021-03-01",
obj_type: 'userstory',
old_obj: { 'X json serialization using pydantic?'},
new_obj: { 'Y json serialization using pydantic?'}
}
Ideally, it should be rendered a diff version with updated fields
It can be reviewed in the user creation endpoint, using separate Pydantic's classes for input validations and json response formatting
The POC also verifies the behaviour when recovering and serializing from the database, a large volume of strongly related objects.
Mainly, it would be analyzed the process of loading sample data, mapping against tables, and the schemas serialization returned in the endpoint.
Install pip-tools if not installed $pip install pip-tools
To include a new package
- Add the package to requirements.in
- Execute
$ pip-compile requirements.in
- Install new packages from the generated requirements.txt
$ pip install -r requirements.txt