I have used 'inspectdb' to produce the model, because I had a dump mysql file. In Meta section of model I have defined the table name:
class Meta: db_table = 'Dataset' Besides If I check the application model with "python manage.py sqlall dataset" I see the same name which has been defined in Meta class. BEGIN; CREATE TABLE `Dataset` Yours, Nader On Sep 6, 1:40 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 9/6/07, Nader <[EMAIL PROTECTED]> wrote: > > > > > I can directly get information from mysql session : > > > mysql> select datasetname from dataset; > ... > > But if I want to get information of the same dataset I got the empty > > list: > > > >>> from ipdc.dataset.models import Dataset > > >>> Dataset.objects.all() > > [] > > > What is actually here wrong? Have I got forgotten something? > > Would somebody tell me how I can solve this problem? > > My initial guess would be that you're not looking at the same table. > Your SQL session is looking at a table called 'dataset' - unless > you're using a Meta option, this won't be the name of your table as > far as Django is concerned. Django will be looking at a table called > 'appname_dataset'. > > If you actually want Django to look in the 'dataset' table, rather > than the name Django creates, look in the Django docs for the Model > Meta option 'db_table'. > > Yours, > Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---