Hi All,

We (as a company) are relatively new to Django and currently implementing a 
system where we use inspectdb to use an existing MSSQL 2005 database from 
within Django.
We have encountered different problems with the ORM part of the application 
in combination with MSSQL, most of which we have been able to solve by 
writing a small Python script that takes the output from dbinspect and does 
some regex to generate a more useful (for us) file.

However, there is now one thing our script is unable to solve (or at least 
it would be relatively hard to solve it in a script.). I was hoping someone 
has some experience with this and can suggest a simple solution;

The database has some varchar([n]) fields, which inspectdb translates into 
textfield types, with no max_length. These fields have defined lengths, so 
a charfield with a max_length would be preferable.The strange thing is 
inspectdb does the right thing for nvarchar([n]) fields, it's just the 
varchar([n]) fields that fail.

Ofcourse your first suggestion might be to just add the max_length 
properties and change the field type in the outputfile, but we have opted 
for a system where we have a class file that has all of the database models 
and that inherits from the output of inspectdb. This allows us to run 
inspectdb as soon as something in the database-structure changes, but to 
keep our models,and modifications to or models, as they are.
The flipside is that in our inherited models class, we can only *add *methods 
and properties, we can't override existing ones. So this problem is not 
fixable in our own models class file.

Any suggestions will be much appreciated,

Thanks,
Erik
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ibJUIsiiUS8J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to