Hello,

I am using two databses for my Django app and one of them is an existing 
MySQL database: 

DATABASES = {
 'default': {
 'ENGINE': 'django.db.backends.sqlite3',
 'NAME': os.path.join(BASE_DIR, 'users.sqlite3'),
 },
 'calls': {
 'ENGINE': 'django.db.backends.mysql',
 'NAME': 'portal2',
 'USER': 'cdraccess',
 'PASSWORD': '******',
 'HOST': '[MY_HOST]',
 },

}


I used inspectdb to create the models for the call and they look like:

class Calls(models.Model):
 callid = models.AutoField(db_column='CallID', primary_key=True) # Field 
name made lowercase.
 conferencename = models.CharField(db_column='ConferenceName', max_length=
200) # Field name made lowercase.
 jointime = models.DateTimeField(db_column='JoinTime') # Field name made 
lowercase.
 leavetime = models.DateTimeField(db_column='LeaveTime', blank=True, null=
True) # Field name made lowercase.

 class Meta:
 managed = True
 db_table = 'ConferenceCall2'


I called makemigrations and then migrate and everything looks fine.

However, when I run a query like Calls.objects.all() the result is: []. 

Or when I tried Calls..objects.count() the result was: 0. The MySQL database is 
not empty, but apparently Django ORM believes that it is.

Am I missing something?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c7052a27-e3ac-41fa-90a1-a1c266cd1c71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to