MySQL data types vs Django/Python data types

Gary Roach gary719_list1 at verizon.net
Sun Sep 1 16:52:01 EDT 2013


Hi all,

System:
	Debian Wheezy Linux
	Python 2.7
	Django 1.5
	MySql 5.5

I am new to Python and Django and am having trouble matching Python data 
types with those of MySQL. MySQL has about 7 basic data types including 
Blobs, Binaries, etc. It also has a rich selection of geometry types. In 
addition, types like INT have 7 or 8 different options like Primary Key, 
zero fill, auto inc, etc. I can't seem to find anything in python to 
match these. I am trying to build a model.py for an existing database 
that was created with MySQL Workbench.

I do not wish to use anything other than MySQL because of the complexity 
of my storage needs (searchable text, PDF, Audio, Video and Photos). The 
text searches will often be word phrase searches through thousands of 
documents. I need the speed and the data type flexibility.

How do I build or modify a model.py to do this. I really don't want to 
write a model.py manually. That would really be a major pain. Workbench 
to the database an import to Django and edit is my choice. 
Unfortunately, the model.py produced has lost most of the functionality 
of the original database and I can't seem to figure out how to fix it.

Any help will be sincerely appreciated.

Gary R.



More information about the Python-list mailing list