Remove blocking call to sqlite by using aiosqlite module.
This commit removes the dependency to sqlalchemy to manage the
sqlite connection and queries. The reason behind is that sqlalchemy
is blocking the event loop in an asyncio context which made each
request needed to have access to the sqlite databases blocking.
The commit replaces sqlalchemy by aiosqlite a async sqlite wrapper
around the sqlite3 module from the standard library.
In order to make it easier to understand the code base, all the
queries used and the classes used to store the queries results
were moved to the mdapi/db.py module.
The views are now stored in the mdapi.views.py and added to the
application router in mdapi/server.py.
The logic which forms the response to the requests based on the
data gathered in the databases is present in mdapi/__init__.py.
It might make sense to move this to the db.py module in a later
commit.
Before this commit mdapi answered an average of 28.5 requests
per seconds for 100 concurent requests.
After this commit mdapi answers an average of 97 requests
per seconds for 100 concurent requests.
Signed-off-by: Clement Verna <cverna@tutanota.com>