On Jan 6, 6:14 pm, Vikram <vikramsingh...@gmail.com> wrote: > Hi, > > I have an existing table in my Oracle db called Sess. Few columns in > this table have names that end with the character '#'. I am unable to > run the command syncdb. > > Steps I did so far: > 1. python manage.py inspectdb > models.py > 2. Spruced up models.py to reflect only single table called Sess. > 3. Running python manage.py syncdb
syncdb is only used to create tables. If the table already exists, then there is no reason to run it. > File "D:\Vikram\Personal\Python\django\database\monitor\models.py", > line 15, in Sess > serial# = models.DecimalField(null=True, max_digits=10, > decimal_places=2, blank=True) > NameError: name 'serial' is not defined The '#' symbol is not allowed in Python identifiers. Python interprets the statement above as being just the identifier 'serial', and the rest of the line is interpreted as a comment. You need to name the field as something that does not include the '#' symbol and use the 'db_column' option to tell Django that the name of the column in the database is different. For example: serial = models.DecimalField(null=True, max_digits=10, decimal_places=2, blank=True, db_column='serial#') Cheers, Ian -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.