# -*- coding: utf-8 -*-


class BaseManager(object):
    """
        Base class for database managers
    """
    __model__ = None

    def __init__(self, session):
        self.session = session

    def get(self, item_id):
        """
            Get object by id
        """
        return self.session.query(self.__model__).get(item_id)

    def from_dict(self, d):
        """
            Create new instance with properties set from dict
        """
        obj = self.__model__(**d)
        self.session.add(obj)
        self.session.flush()
        return obj

    def all(self):
        """
            Return all entities
        """
        return self.session.query(self.__model__).all()

    def find(self, **kwargs):
        """
            Returns a list of instances of the service's model filtered by the
            specified key word arguments.
        """
        return self.session.query(self.__model__).filter_by(**kwargs)

    def get_or_insert(self, **kwargs):
        """
            Find and return first entry or create a new one
        """
        entry = self.find(**kwargs).first()
        if not entry:
            entry = self.from_dict(kwargs)

        return entry

    def delete(self, entry):
        """
            Delete entry from db
        """
        self.session.delete(entry)

    def delete_by_id(self, pk):
        """
            Delete entry by id
        """
        entry = self.get(pk)
        self.delete(entry)

@@ -432,20 +432,23 @@
 et from 
-dict
+_values
 %0A       
@@ -1451,20 +1451,172 @@
  self.delete(entry)%0A
+%0A    def delete_all(self):%0A        %22%22%22%0A            Delete all records from table%0A        %22%22%22%0A        return self.session.query(self.__model__).delete()%0A

Delete all method