I'm trying to work with a legacy DB, but since my legacy DB is MS sql
and I am just getting started, I thought I'd run it on the DB from the
tutorial that is in postgre just to make sure I was doing everything
right. With the following command line:
django-admin.py inspectdb --settings=mysite.settings
I get the error below.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or
field name
s.
#
# Also note: You'll have to insert the output of 'django-admin.py
sqlinitialdata
[appname]'
# into your database.
from django.db import models
class PgTsDict(models.Model):
dict_name = models.TextField(primary_key=True)
dict_init = models.TextField() # This field type is a guess.
dict_initoption = models.TextField()
dict_lexize = models.TextField() # This field type is a guess.
dict_comment = models.TextField()
class Meta:
db_table = 'pg_ts_dict'
class PgTsParser(models.Model):
prs_name = models.TextField(primary_key=True)
prs_start = models.TextField() # This field type is a guess.
prs_nexttoken = models.TextField() # This field type is a guess.
prs_end = models.TextField() # This field type is a guess.
prs_headline = models.TextField() # This field type is a guess.
prs_lextype = models.TextField() # This field type is a guess.
prs_comment = models.TextField()
class Meta:
db_table = 'pg_ts_parser'
class PgTsCfg(models.Model):
ts_name = models.TextField(primary_key=True)
prs_name = models.TextField()
locale = models.TextField()
class Meta:
db_table = 'pg_ts_cfg'
class PgTsCfgmap(models.Model):
ts_name = models.TextField()
tok_alias = models.TextField()
dict_name = models.TextField() # This field type is a guess.
class Meta:
db_table = 'pg_ts_cfgmap'
class AuthMessage(models.Model):
Traceback (most recent call last):
File "C:\Program
Files\Python24\Lib\site-packages\django\bin\django-admin.py",
line 5, in ?
management.execute_from_command_line()
File "C:\Program
Files\Python24\lib\site-packages\django\core\management.py",
line 1246, in execute_from_command_line
for line in action_mapping[action]():
File "C:\Program
Files\Python24\lib\site-packages\django\core\management.py",
line 718, in inspectdb
relations = introspection_module.get_relations(cursor, table_name)
File "C:\Program
Files\Python24\lib\site-packages\django\db\backends\postgresq
l_psycopg2\introspection.py", line 35, in get_relations
relations[int(row[0][1:-1]) - 1] = (int(row[1][1:-1]) - 1, row[2])
TypeError: int() argument must be a string or a number
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---