Wednesday, 20 March 2019

Using Architect with Django Abstract Model class

As specified by PyPI Architect, for partitioning we can use the decorator on any model class in the following way:

import architect

@architect.install('partition', **options)
class Model(object):
    pass

My model is abstract, the column to be partitioned on is present in abstract Model and I want all the child models to have the same partitioning.

import architect

@architect.install('partition', **options)
class Model(object):
    class Meta:
        abstract = True

  • Is the above structure correct way to use?
  • Will all the child models implement the same partitioning automatically?
  • If yes, is it safe to specify decorator at the abstract level (good practice)?

Django: 2.x || Python: 3.x || MySQL: 5.x



from Using Architect with Django Abstract Model class

No comments:

Post a Comment