Allow Meta class to have extra Database specific options

Without diving too deep, I think so, something else to take into account is that I’m already adding database specific functions and behavior to CrateModel(models.Model) example:

class CrateModel(models.Model, metaclass=MetaCrate):
    """
    A base class for Django models with extra CrateDB specific functionality,

    Methods:
        refresh: Refreshes the given model (table)
    """

    @classmethod
    def refresh(cls):
        with connection.cursor() as cursor:
            cursor.execute(f"refresh table {cls._meta.db_table}")

    class Meta:
        abstract = True

so I need to have a custom CrateModel anyway, maybe it’s just cleaner to only have to modify the ModelBase

1 Like