Re: Tables missing in SQLite but viewable in admin (confusion)

2021-05-29 Thread Ryan Kite
Thanks, Antonis, you were correct. The app was not actually using the 
SQLite DB it was using a different one that was not on the local machine. 

On Saturday, May 29, 2021 at 2:59:44 AM UTC-7 Antonis Christofides wrote:

> The table name by default has the app name prepended; so the table for 
> PastSurgicalHistory will be named superhealth_pastsurgicalhistory (assuming 
> that your app is named superhealth).
>
> Other than that, I'd make absolutely sure that the database I'm examining 
> with the sqlite3 command (or whatever tool you have) is really the same as 
> the one that is being read by Django. E.g. move the database file somewhere 
> else (and restart Django) and make sure that the data in Django admin is 
> gone.
>
> Antonis Christofides+30-6979924665 <+30%20697%20992%204665> (mobile)
>
>
> On 29/05/2021 02.56, Ryan Kite wrote:
>
> Greetings! 
>
> Am very confused about why the local dev SQLite DB 'appears' to be missing 
> several tables.
>
> In the Django Admin they exist and have data. 
>
> I would be expecting to see the following tables in the DB but can't find 
> them.
> (These are the model names since I don't know what the table name look 
> like yet.) 
>
>- Model: Allergies | Table: ? 
>- Model: DoctorsAndProviders | Table: ? 
>- Model: FamilyContacts | Table: ? 
>- Model: PastSurgicalHistory | Table: ? 
>- Model: HealthProfile | Table: ? 
>
> But, I do see these two models with their tables in the DB
>
>- Model: Med | Table: meds 
>- Model: PastMedicalHistory  | Table: past_med_hx 
>
>
> The application seems to be working for the most part, we can still add 
> and remove objects. But was encountering errors when trying to build a 
> ForeignKey from the Allergies model to the HealthProfile Model that lives 
> under the Users app. The error said something along the lines about the ID 
> did not exist in the table? Which caused me to view the DB and notice this. 
>
> Any help appreciated :)
>
> screenshots attached.
>
>
> -- 
> 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...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/9f7fecd6-b152-4e6d-8a9e-d22508b9d975n%40googlegroups.com
>  
> 
> .
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8dd5d6e4-2f9d-473c-bd4e-d1617aef2a48n%40googlegroups.com.


Re: Tables missing in SQLite but viewable in admin (confusion)

2021-05-29 Thread Antonis Christofides
The table name by default has the app name prepended; so the table for 
PastSurgicalHistory will be named superhealth_pastsurgicalhistory (assuming that 
your app is named superhealth).


Other than that, I'd make absolutely sure that the database I'm examining with 
the sqlite3 command (or whatever tool you have) is really the same as the one 
that is being read by Django. E.g. move the database file somewhere else (and 
restart Django) and make sure that the data in Django admin is gone.


Antonis Christofides
+30-6979924665 (mobile)


On 29/05/2021 02.56, Ryan Kite wrote:

Greetings!

Am very confused about why the local dev SQLite DB 'appears' to be missing 
several tables.


In the Django Admin they exist and have data.

I would be expecting to see the following tables in the DB but can't find them.
(These are the model names since I don't know what the table name look like 
yet.)

  * Model: Allergies | Table: ?
  * Model: DoctorsAndProviders | Table: ?
  * Model: FamilyContacts | Table: ?
  * Model: PastSurgicalHistory | Table: ?
  * Model: HealthProfile | Table: ?

But, I do see these two models with their tables in the DB

  * Model: Med | Table: meds
  * Model: PastMedicalHistory  | Table: past_med_hx


The application seems to be working for the most part, we can still add and 
remove objects. But was encountering errors when trying to build a ForeignKey 
from the Allergies model to the HealthProfile Model that lives under the Users 
app. The error said something along the lines about the ID did not exist in 
the table? Which caused me to view the DB and notice this.


Any help appreciated :)

screenshots attached.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9f7fecd6-b152-4e6d-8a9e-d22508b9d975n%40googlegroups.com 
.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7ef773e1-3c6e-86e5-c9c5-f9668daa5439%40antonischristofides.com.


Re: Tables missing in SQLite but viewable in admin (confusion)

2021-05-28 Thread Mottaz Hegaze
Maybe those are not migrated yet,
make sure that all your apps are added to installed_apps list in
settings.py , run makemigrations and migrate

On Sat, May 29, 2021 at 1:56 AM Ryan Kite  wrote:

> Greetings!
>
> Am very confused about why the local dev SQLite DB 'appears' to be missing
> several tables.
>
> In the Django Admin they exist and have data.
>
> I would be expecting to see the following tables in the DB but can't find
> them.
> (These are the model names since I don't know what the table name look
> like yet.)
>
>- Model: Allergies | Table: ?
>- Model: DoctorsAndProviders | Table: ?
>- Model: FamilyContacts | Table: ?
>- Model: PastSurgicalHistory | Table: ?
>- Model: HealthProfile | Table: ?
>
> But, I do see these two models with their tables in the DB
>
>- Model: Med | Table: meds
>- Model: PastMedicalHistory  | Table: past_med_hx
>
>
> The application seems to be working for the most part, we can still add
> and remove objects. But was encountering errors when trying to build a
> ForeignKey from the Allergies model to the HealthProfile Model that lives
> under the Users app. The error said something along the lines about the ID
> did not exist in the table? Which caused me to view the DB and notice this.
>
> Any help appreciated :)
>
> screenshots attached.
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9f7fecd6-b152-4e6d-8a9e-d22508b9d975n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-fMxuouf-m3wt5dvn%2BpEwiobspo3aRLrUK-9LtOrVrVxw%40mail.gmail.com.