Skip to main content

Provide hints to optimize database usage by deferring unused fields

Project description

=============================
Django Eraserhead
=============================

.. image:: https://badge.fury.io/py/django-eraserhead.svg
:target: https://badge.fury.io/py/django-eraserhead

.. image:: https://travis-ci.org/dizballanze/django-eraserhead.svg?branch=master
:target: https://travis-ci.org/dizballanze/django-eraserhead

.. image:: https://codecov.io/gh/dizballanze/django-eraserhead/branch/master/graph/badge.svg
:target: https://codecov.io/gh/dizballanze/django-eraserhead

Provide hints to optimize database usage by deferring unused fields

.. image:: https://github.com/dizballanze/django-eraserhead/raw/master/eraserhead.jpg

Documentation
-------------

Requirements
-----------

* Django 1.9+
* Python 2.7, 3.4+

Quickstart
----------

Install Django Eraserhead::

pip install django-eraserhead

Add it to your `INSTALLED_APPS`:

.. code-block:: python

INSTALLED_APPS = (
...
'eraserhead.apps.EraserheadConfig',
...
)

ERASERHEAD_ENABLED = True
ERASERHEAD_TRACEBACK_BASE_PATH = BASE_DIR


Settings:

* `ERASERHEAD_ENABLED` - enable/disable Django Eraserhead
* `ERASERHEAD_TRACEBACK_BASE_PATH` - set base path to filter tracebacks. Set to `None` to display full traceback.

Features
--------

.. image:: https://github.com/dizballanze/django-eraserhead/raw/master/screenshot.png

Django Eraserhead monitors:

* querysets/models fields usage (used and unused fields) with considering deferred fields
* count of instances created for each queryset
* corresponding model of each queryset
* traceback for each queryset to easily find corresponding code

Based on fields usage Django Eraserhead suggests optimizations for each queryset.


TODO
-----

* calculate memory consumption of unused fields
* decorator and/or context processor for partial stats collecting
* detect deferred fields loading
* auto deferring fields based on usage

Running Tests
-------------

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits
-------

Tools used in rendering this package:

* Cookiecutter_
* `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-eraserhead-0.1.3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

django_eraserhead-0.1.3-py2.py3-none-any.whl (7.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-eraserhead-0.1.3.tar.gz.

File metadata

File hashes

Hashes for django-eraserhead-0.1.3.tar.gz
Algorithm Hash digest
SHA256 63ae9ae6da93e2da472d0d4e35b2514ab58bab150b9b011232c9649f8bfa02b6
MD5 365e284b414cea22dd49abc9dc6929f3
BLAKE2b-256 4a2cf2fed411b79eaa3366c6560bad33d77b6da5e4eb61afb75cdf87fdee0fe2

See more details on using hashes here.

File details

Details for the file django_eraserhead-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_eraserhead-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 099908ba0b521b7f67c7c6a491376d0338e754afe10fe8e8f3136e9d48443e1d
MD5 a087439322811eaed21190ecf0c64a4f
BLAKE2b-256 8974e0c3794c1f2bb956b7263bff9ad0a1ad12fcc732d38b7f5b9ce81516adce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page