Metadata-Version: 1.1
Name: django-qc
Version: 0.0.1
Summary: DB utility to help you catch query inefficiencies in Django.
Home-page: https://github.com/sondrelg/django-query-counter
Author: Sondre Lillebø Gundersen
Author-email: sondrelg@live.no
License: BSD
Download-URL: https://pypi.python.org/pypi/django-qc
Description: #########################
        Django Query Count Helper
        #########################
        
        This is a simple implementation of the `django_query_analyze` function detailed in
        `The Django Speed Handbook: making a Django app faster <https://openfolder.sh/django-faster-
        speed-tutorial?utm_campaign=Django%2BNewsletter&utm_medium=email&utm_source=Django_Newsletter_13>`_, featured in the
        Django newsletter a few weeks back.
        
        The idea is that you can wrap you pure db-query functions with a decorator, and make sure the function is calling the database as you expect it to.
        
        .. code-block:: python
        
            from django_qc import db_helper
            from app.models import Song
        
            @db_helper(count=1)
            def get_songs():
                return serialize_songs(Song.objects.all(), many=True)
        
        See the original article for a more thorough description of the issue.
        
        Since the Django ORM is lazy, you will likely want to wrap your serializers rather than your queries, if they're not in the same function. For example:
        
        .. code-block:: python
        
            from django_qc import db_helper
        
            @db_helper(count=1)
            def serialize_songs(song: Song)
                return {
                    'name': song.name,
                    'cd': song.cd.name,
                }
        
        This package should only run during development.
        
        ************
        Installation
        ************
        
        Install using pip:
        
        .. code-block:: bash
        
            pip install django-qc
        
        ********
        Settings
        ********
        
        There are three settings that can be configured:
        
        .. code-block:: python
        
            DB_HELPER {
                'RAISE_EXC': True,
                'LOG_EXC': True,
                'DEBUG': DEBUG
            }
        
        
        * :code:`RAISE_EXC`
                Whether or not to raise an error when the specified query count deviates the actual query count.
        
            Default: True
        
        * :code:`LOG_EXC`
                Whether or not to log an exception (logger.exception) when the specified query count deviates the actual query count.
                If you're using Sentry or similar tools, an exception logger will raise an issue in the system.
                This only applies to when RAISE_EXC is False.
        
            Default: True
        
        * :code:`DEBUG`
                Whether or not to check query counts at runtime.
        
            Default: True
        
        
Keywords: orm,database,queries,testing,performance
Platform: OS Independent
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Documentation
