v2ray-configurator

ordered list in a database

Previous development reveals that relation-based databases cannot properly handle arrays that need insert() method.

A hack is to use a string-based index that allows gaps between indexes so that insertion can be realized without reordering the rest of the entries. [1]

This is feasible on the SQL level but the availability under ORM tools still needs investigation.

ORM: SQLAlchamy vs Django

On the ORM side, I also tried Django as an alternative to SQLAlchamy.

Some major difference includes:

  • Django builds the database according to the model, while SQLAlchamy requires manual mapping. This may be a desired feature for fast development but comes at a cost of less extensibility as an ORM
  • Django model object links to each other by a query manager while SQLAlchamy object links to each other directly. The Django way will cause a problem in type hint that would require further hacks like django_hint and manual type decalration everytime a query is made. I consider this as a feature missing bug of Django
  • Django comes with a lot of other features since it's developed as more of a website backend than a simple ORM

  1. Django: define a name for reverse ForeignKey - Stack Overflow ↩︎

Hover your mouse or tap on the left edge to navigate.
Upon dismissing, you acknowledge that you have read and understand our Privacy Policy.