This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description
Django BigAuto Hack

`Support for BigAutoField <>`_ has been a work in progress for 4 years now. But the ticket has the following valuable comment:

In the meantime, it suffices to use a standard AutoField and hack the database like so:

In the table in question, alter the field like so: ``ALTER TABLE [table_name] ALTER COLUMN [field_name] [data_type]``, where ``[data_type]`` is one of the following:

- Oracle: NUMBER(19)
- PostgreSQL: bigserial
- SQLite: integer

For every foreign key pointing to your field, you will also need to alter the column, but with these data types:

- MySQL: bigint
- Oracle: NUMBER(19)
- PostgreSQL: bigint
- SQLite: integer

This is a pain, but you only need to do it when creating tables, once. On the other hand, users shouldn't have to hack the database for such a simple feature, in my opinion. It would be super-cool if 1.3 included a fully-functional BigAutoField.

This simple django app makes this hack less of pain. Running


$ python bigautohack myapp.MyModel

Will run the needed ``ALTER TABLE`` commands, turning the database column for ``MyModel``'s primary key into a big integer, as well as all columns referencing ``MyModel``.

To install simply run ``pip install django-bigautohack`` and add ``bigautohack`` to your ``INSTALLED_APPS``.


You probably need to make generic foreign keys use a big integer as well.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-bigautohack-0.1.tar.gz (3.7 kB) Copy SHA256 Checksum SHA256 Source Aug 30, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting