Skip to content


This section refers to the extras that Saffier offer and can be used in your application without incurring into extra overhead to make it happen.

If you are in this section, you surely read about the auto discovery and how it relates with the way Saffier handles and manages migrations for you.

But, what if you simply would like to use the shell or any related command offered by Saffier that doesn't necessarily requires migration management?

The Migrate object is the way of Saffier knowing what to do and how to manage your models but there are cases where that doesn't happen and it is not needed, for example, a project using reflect models.

A project using reflect models, means that somehow migrations are managed externally and not by Saffier and Saffier only needs to reflect those tables back into your code, so, do you really need the Migrate object here? Short answer is no.

So how can you still use those features without depending on the Migrate object? Enters SaffierExtra.


This is the object you want to use when you don't need Saffier to manage the migrations for you and yet still being able to use Saffier tools like the shell.

How does it work

Well, its actually very similar to Migrate object in terms of setup.

Let us use Esmerald again as an example like we did for the tips and tricks.

#!/usr/bin/env python
Generated by 'esmerald-admin createproject'
import os
import sys
from pathlib import Path

from esmerald import Esmerald, Include

import saffier
from saffier import Database, Registry, SaffierExtra

database = Database("sqlite:///db.sqlite")
registry = Registry(database)

class CustomModel(saffier.Model):
    name = saffier.CharField(max_length=255)
    email = saffier.EmailField(max_length=255)

    class Meta:
        registry = registry

def build_path():
    Builds the path of the project and project root.
    SITE_ROOT = os.path.dirname(os.path.realpath(__file__))

    if SITE_ROOT not in sys.path:
        sys.path.append(os.path.join(SITE_ROOT, "apps"))

def get_application():
    This is optional. The function is only used for organisation purposes.

    app = Esmerald(

    SaffierExtra(app=app, registry=registry)
    return app

app = get_application()

And that is it, you can use any tool that does not relate with migrations in your application.


Be aware of the use of this special class in production! It is advised not to use it there.


For now, besides the migrations and the shell, Saffier does not offer any extra tools but there are plans to add more extras in the future and SaffierExtra is the way to go for that setup.