Metadata-Version: 1.0
Name: django-db-parti
Version: 0.2.1
Summary: Fully automatic database table partitioning for Django
Home-page: https://github.com/maxtepkeev/django-db-parti
Author: Max Tepkeev
Author-email: tepkeev@gmail.com
License: Copyright (c) 2013 Max Tepkeev
All rights reserved.
 
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
 
    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.
    
    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
 
    3. Neither the name of this project nor the names of its contributors may be
       used to endorse or promote products derived from this software without
       specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description: Django DB Parti
        ===============
        
        Django DB Parti is a package for Django which aim is to make table partitioning on the fly.
        Partitioning is a division of one large table into smaller tables which represent that table.
        Partitioning is usually done for manageability, performance or availability reasons. If you
        are unsure whether you need partitioning or not, then you almost certainly don't need it.
        
        Requirements
        ------------
        
        * Django 1.5 (http://www.djangoproject.com) (may work with older versions, but untested)
        
        Installation
        ------------
        
        From pypi_:
        
        .. code-block:: bash
        
            $ pip install django-db-parti
        
        or clone from github_:
        
        .. code-block:: bash
        
            $ git clone git://github.com/maxtepkeev/django-db-parti.git
        
        Configuration
        -------------
        
        Add dbparti to PYTHONPATH and installed applications:
        
        .. code-block:: python
        
            INSTALLED_APPS = (
                ...
                'dbparti'
            )
        
        Create the model as usual which will represent the partitioned table and run syncdb to create a table for the
        model, if you are using South for migrations, you can also create the model as usual via migrate. No additional
        steps required. After that we need to make a few changes to the model:
        
        \1) In models.py add the following import statement at the top of the file:
        
        .. code-block:: python
        
            from dbparti.models import Partitionable
        
        \2) Make your model to inherit from Partitionable, to do that change:
        
        .. code-block:: python
        
            class YourModelName(models.Model):
        
        to:
        
        .. code-block:: python
        
            class YourModelName(Partitionable):
        
        \3) Optionally add a Meta class to your model with a few settings (or if you already have a Meta class change it as the following):
        
        .. code-block:: python
        
            class Meta(Partitionable.Meta):
                partition_range = 'month'
                partition_column = 'partdate'
        
        \4) Lastly we need to initialize some database stuff, to do that execute the following command:
        
        .. code-block:: bash
        
            $ python manage.py partition app_name
        
        That's it! Easy right?! Now a few words about what we just did. We made our model to inherit from Partitionable, also we
        used "month" as partition range and "partdate" as partition column, that means that from now on, a new partition will be
        created every month and a value from partdate column will be used to determine into what partition the data should be saved.
        Keep in mind that if you add new partitioned models to your apps or change any settings in the existing partitioned models,
        you need to rerun the command from step 4, otherwise the database won't know about your changes. You can also customize how
        data from that model will be displayed in the Django admin interface, for that you need to do the following:
        
        \1) In admin.py add the following import statement at the top of the file:
        
        .. code-block:: python
        
            from dbparti.admin import PartitionableAdmin
        
        \2) Create admin model as usual and then change:
        
        .. code-block:: python
        
            class YourAdminModelName(admin.ModelAdmin):
        
        to:
        
        .. code-block:: python
        
            class YourAdminModelName(PartitionableAdmin):
        
        \3) Optionally add a setting which tells how records are displayed in Django admin interface (more on that below):
        
        .. code-block:: python
        
            partition_show = 'all'
        
        Available settings
        ------------------
        
        Model settings:
        ~~~~~~~~~~~~~~~
        
        All model settings are done inside model's Meta class which should inherit from Partitionable.Meta
        
        ``partition_range`` - how often a new partition will be created, currently accepts the following:
        
        * week
        * month (default)
        
        ``partition_column`` - column name, which value will be used to determine which partition record belongs to:
        
        * partdate (default)
        
        ModelAdmin settings:
        ~~~~~~~~~~~~~~~~~~~~
        
        All model admin settings are done inside model admin class itself
        
        ``partition_show`` - data from which partition will be shown in Django admin, the following values are possible:
        
        * all (default)
        * current
        * previous
        
        Example
        -------
        
        Let's imagine that we would like to create a table for storing log files. Without partitioning our table would have
        millions of rows very soon and as the table grows performance will become slower. With partitioning we can tell database
        that we want a new table to be created every month and that we will use a value from partdate to determine to which partition
        every new record belongs to. To be more specific let's call our table "logdata", it will have only 3 columns: id, content and
        logdate. Now when we insert the following record: id='1', content='blablabla', logdate='2013-05-20', this record will be
        inserted not to our "logdata" table but to the "logdata_y2013m05", then if we insert another record like that: id='2',
        content='yadayadayada', logdate='2013-07-16' it will be inserted to the table "logdata_y2013m07" BUT the great thing about
        all of that is that you are doing your inserts/updates/selects to the table "logdata"! Again, you are working with the table
        "logdata" as usual and you don't may even know that actually your data is stored in a lot of different tables, everything is
        done for you automatically at the database level, isn't that cool ?!
        
        Backends
        --------
        
        Django DB Parti is designed in a modular way, so new db backends can be added easily, currently the following backends are available:
        
        * mysql
        * postgresql
        
        Limitations
        -----------
        
        | 1) Partitioning is only possible on a date or datetime basis, so you can't partition for example by ZIP code or something else.
             Other partitioning options will be added in next releases.
        | 2) Partitioning is not available for bulk inserts (i.e. Django's bulk_create() method) becouse it doesn't call model's save()
             method which Django DB Parti relies on.
        | 3) There are some backend limitations for partitioned tables, please see the backend site for details.
        | 4) Perhaps there are more limitations that I'm not aware of, if you find any - let me know.
        
        Contact & Support
        -----------------
        
        I will be glad to get your feedback, pull requests, issues, whatever. Feel free to contact me for any questions.
        
        Copyright & License
        -------------------
        
        ``django-db-parti`` is protected by BSD licence.
        
        .. _pypi: https://pypi.python.org/pypi/django-db-parti
        .. _github: https://github.com/maxtepkeev/django-db-parti
        
        
        .. :changelog:
        
        Changelog
        ---------
        
        0.2.1 (2013-08-24)
        ~~~~~~~~~~~~~~~~~~
        
        - Updated readme
        - Python 3 compatibility
        - Datetime with timezone support (Issue #1)
        
        0.2.0 (2013-06-10)
        ~~~~~~~~~~~~~~~~~~
        
        - Added mysql backend
        - Fixed incorrect handling of datetime object in DateTimeMixin
        
        0.1.5 (2013-06-08)
        ~~~~~~~~~~~~~~~~~~
        
        - Updated readme
        - Fixed postgresql backend error which sometimes tried to insert the data into partitions that don't exist
        - Moved all the database partition system stuff to the command ``partition`` (see readme), that gave a lot
          in speed improvement because we don't need to check for trigger existance and some other things at runtime
          anymore
        
        0.1.4 (2013-06-01)
        ~~~~~~~~~~~~~~~~~~
        
        - Packaging fix
        
        0.1.3 (2013-06-01)
        ~~~~~~~~~~~~~~~~~~
        
        - Packaging fix
        
        0.1.2 (2013-06-01)
        ~~~~~~~~~~~~~~~~~~
        
        - Packaging fix
        
        0.1.1 (2013-06-01)
        ~~~~~~~~~~~~~~~~~~
        
        - Packaging fix
        
        0.1.0 (2013-06-01)
        ~~~~~~~~~~~~~~~~~~
        
        - Initial release
        
Keywords: django,partition,database,table
Platform: UNKNOWN
Classifier: Framework :: Django
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Internet
Classifier: License :: OSI Approved :: BSD License
Classifier: Intended Audience :: Developers
Classifier: Environment :: Web Environment
Classifier: Programming Language :: Python :: 2.7
