Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

BACKGROUND:

I'm trying to build a database that supports many-to-many relationships using Django and an existing MySQL database as a next-step after going through the Django "polls" tutorial.

I'm running a virtual environment containing Python 3.4, Django 1.9.2, mysql-connector-python 2.1.3.

I'm connecting to a MySQL DB running on MAMP via 'ENGINE': 'mysql.connector.django' in the project settings.py

The settings in my project should be correct as I had no problem using inspect db to extract models from the existing MySQL database.

THE PROBLEM:

After looking over and editing the models inspectdb created, I wanted to migrate them to the DB. I copied the models to the app's models.py and ran the migrate command. Unfortunately, it's now throwing errors, and being new to django, I'm not quite certain where the problem is happening. I'm seeing:

(begin error excerpt)

Operations to perform:
  Apply all migrations: admin, sessions, auth, contenttypes
Running migrations:
  Rendering model states... DONE
  Applying contenttypes.0001_initial...Traceback (most recent call last):
  File "/path/to/virtualenv/lib/python3.4/site-packages/mysql/connector/django/base.py", line 177, in _execute_wrapper
    return method(query, args)
  File "/path/to/virtualenv/lib/python3.4/site-packages/mysql/connector/cursor.py", line 515, in execute
    self._handle_result(self._connection.cmd_query(stmt))
  File "/path/to/virtualenv/lib/python3.4/site-packages/mysql/connector/cursor.py", line 434, in _handle_result
    self._handle_noresultset(result)
  File "/path/to/virtualenv/lib/python3.4/site-packages/mysql/connector/cursor.py", line 404, in _handle_noresultset
    self._warnings[0][1], self._warnings[0][2])
mysql.connector.errors.DatabaseError: 1264: Out of range value for column 'applied' at row 1

During handling of the above exception, another exception occurred:

(end error excerpt)

WHAT I THINK IS HAPPENING

Reading that error message, I'm looking at one of two things as culprits: contenttypes or the mysql connector settings ('ENGINE': 'mysql.connector.django',).

I've found the django documentation for ContentTypes models, but what's on the page doesn't seem to help diagnosing my problem.

I'm curious if it's the connector and, if so, why since inspectdb had no problems extracting models.

Can anyone give me some insight on what's happening?

Thanks!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.