Keep Learning Everyday
- Keep Learning Everyday, learning relational database management
system at the moment
- learn fundamentals and use tools with long shelf-life
- Tips for clear writing: write individual characters and each
characters take up full square
- write shell, vimscript in python
- Daily
- stand for stand up
- run FP fee fixing and missing atr fixing script
- reminder:
= to format python, d for
documentation
Postgres Performance and
Concurrency
- consider transaction
- mutiple save
- select + save, would it introduce concurrent overwritten issue?
consider
select_for_update?
- care about DB Performance!
- use database indexing with
db_index=True
- use
self.assertNumQueries
print(queryset.query)
- set
django.db.backend config to debug to print the sql
queries
- optimize queries with
select_related and
prefetch_related
Exception Handling
- How To Handle Exception (thanks to Sentry Django Project)
- only catch specific exceptions when you have a meaningful way to
handle them
- Let exceptions bubble up unless you need to:
- add context to the error
- perform cleanup operations
- covert one exception type to another with additional
information
- recover from expected error conditions
- think about exception handling on every HTTP Requests
Documentation
- add order of operation (inspired by Network
Protocol), order is not obvious to derive from reading a bunch of
functions/methods