I believe table names are all lower-case, so try 'sample_app_person'
-- 
Michael <mhall...@gmail.com>

On Tue, 2011-01-25 at 08:33 -0800, Ben Dembroski wrote:
> Attempting to add the db_table name to the model made things a bit
> more confusing.
> 
> The original app's name was 'sample_app'  (not my choosing)
> 
> The app that I'm trying to get to access the data is 'trajectories'
> 
> 
> 
> I just added the following the Meta class for one of the models:
> 
> 
> class Meta:
>               db_table = 'sample_app_Person'
> 
> and got the following when I ran syncdb:
> Traceback (most recent call last):
>   File "manage.py", line 11, in <module>
>     execute_manager(settings)
>   File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> __init__.py", line 438, in execute_manager
>     utility.execute()
>   File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> __init__.py", line 379, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> base.py", line 191, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> base.py", line 220, in execute
>     output = self.handle(*args, **options)
>   File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> base.py", line 351, in handle
>     return self.handle_noargs(**options)
>   File "/usr/local/lib/python2.6/dist-packages/django/core/management/
> commands/syncdb.py", line 95, in handle_noargs
>     cursor.execute(statement)
>   File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
> util.py", line 15, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
> sqlite3/base.py", line 200, in execute
>     return Database.Cursor.execute(self, query, params)
> django.db.utils.DatabaseError: table "sample_app_Person" already
> exists
> 
> If I run the shell, and try to get to the data, I get this:
> 
> (InteractiveConsole)
> >>> from trajectories.models import Person
> >>> Person.objects.all()
> Traceback (most recent call last):
>   File "<console>", line 1, in <module>
>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/
> query.py", line 67, in __repr__
>     data = list(self[:REPR_OUTPUT_SIZE + 1])
>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/
> query.py", line 82, in __len__
>     self._result_cache.extend(list(self._iter))
>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/
> query.py", line 271, in iterator
>     for row in compiler.results_iter():
>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/
> compiler.py", line 677, in results_iter
>     for rows in self.execute_sql(MULTI):
>   File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/
> compiler.py", line 732, in execute_sql
>     cursor.execute(sql, params)
>   File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
> util.py", line 15, in execute
>     return self.cursor.execute(sql, params)
>   File "/usr/local/lib/python2.6/dist-packages/django/db/backends/
> sqlite3/base.py", line 200, in execute
>     return Database.Cursor.execute(self, query, params)
> DatabaseError: no such column: sample_app_Person.dobestm
> 
> Any ideas ?
> 
> Thanks again!
> 
> On Jan 25, 4:02 pm, Ben Dembroski <i...@ionraystudios.com> wrote:
> > Thanks.
> >
> > I suspect this is the issue, as I just changed the settings.py file on
> > the original project to point to the copied database file.   It has no
> > problem accessing the data.  I'll play around with the meta settings
> > and see what I can come up with.
> >
> > Thanks!
> >
> > On Jan 25, 3:46 pm, Michael <mhall...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > The database tables are named {{app_label}}_{{model_name}}, so in order
> > > to use the same database you will need to use the same application name
> > > (or specify db_table in the model's Meta).
> >
> > > --
> > > Michael <mhall...@gmail.com>
> >
> > > On Tue, 2011-01-25 at 07:36 -0800, Ben Dembroski wrote:
> > > > Hi all,
> >
> > > > Afraid I've got another newbie question.   I've been doing some
> > > > development on a project using sqlite3.  All is working well, and I'd
> > > > like to use the same database file in another project, data intact.
> > > > I've copied the database file, and the models.py file to the
> > > > appropriate locations in the new project.   When I run syncdb, the
> > > > only result is 'no fixtures found.'
> >
> > > > When I pop into the shell, all the fields are there, but I can't get
> > > > to the data in any of them.
> >
> > > > For instance, inside the shell for the new project I run:
> >
> > > > Person.objects.all()
> >
> > > > it returns
> >
> > > > []
> >
> > > > Do I need to do something besides just copying the database file to
> > > > keep my data, provided the models.py files are unchanged?
> >
> > > > Many thanks,
> > > > Ben
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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