An ORM can bite you

[ python  orm  sqlalchemy  database  ]

15 May 2022

Object Relational Mappers (ORMs) are widely used in software development to abstract a database operations in our application code by providing a layer between object-oriented programming language and relational tables in a database. However we should be conscious that simple and inconspicuous expressions provided by our ORM can lead to heavy actions underhood. To present it I will take SQLAlchemy, one of the most popular ORM in Python world.
Read More

Concurrent write problem

[ concurrency  postgresql  locking  database  ]

22 April 2022

Concurrency control is one of the most challenging aspects of software development. Sometimes, we have a tendency to wishful thinking and naive beliefs that our advanced toolkit like a web framework, a database or an ORM solve all our issues seamlessly underhood. However, when we tackle non-trivial problem (like concurrent write), we have to demonstrate some understanding how these tools genuinely work (and maybe why they are configured in the specific way).
Read More

GraphQL authentication and authorization

[ rest  graphql  python  auth  ]

5 January 2022

In this second post regarding GraphQL I would like to show how to manage authentication and authorization in GraphQL API. Authentication and authorization are often mixed each other but these concepts are responsible for different processes. The former determine user identity (whether user is logged in or 'recognized' by a system), while the latter refers to whether an authenticated user has access to a given resource. So usually authentication stage precede authorization one.
Read More

Coupling. Two perspectives

[ python  coupling  ]

14 December 2021

Coupling is a concept used in software engineering to define how tight is a relationship between system components (classes, modules, subsystems). Coupling is strictly connected to cohesion concept ("togetherness" of a component) and there is a common heuristic for software developers that we should design components that have high cohesion and are loosely coupled.
Read More

Persistance and domain model separation using SQLAlchemy ORM

[ python  sqlalchemy  domain-model  persistance-model  unit-tests  ]

28 November 2021

You probably have heard about a test pyramid. It is the idea that tan application should have proper balance of automated tests on different layers. There should be a lot of unit tests, significantly less integration tests and a few UI tests (End2End, functional). The reasons for this are maintenence cost and speed of particular test type. Unit tests are usually fast and isolated from the rest of the code (so are easy to setup and maintain).
Read More