I've got a project that's been developed using django 1.11. I've tried 
upgrading to 2.0, but now I'm getting an error I haven't been able to track 
down.

My database engine is sqlite3. I have three database files:
  - db.sqlite3 is the default. This is the only one that django manages, 
and the only one that is writable.
  - components.sqlite3 contains a library of engineering component data. 
  - slat_constants.sqlite3 contains constants used by the project. In 
particular, the 'slat_locations' table holds information about sites in NZ.

I have a Model that exposes the location data:
    class Location(models.Model):
        location = models.CharField(max_length=128)
        z = models.FloatField()
        min_distance = models.FloatField(null = True)
        max_disstance = models.FloatField(null = True)

        class Meta:
            managed = False
            db_table = 'slat_location'

and another that uses it:
    class NZ_Standard_Curve(models.Model):
        SOIL_CLASS_A = 'A'
        SOIL_CLASS_B = 'B'
        SOIL_CLASS_C = 'C'
        SOIL_CLASS_D = 'D'
        SOIL_CLASS_E = 'E'
        SOIL_CLASS_CHOICES = (
            (SOIL_CLASS_A, 'A'),
            (SOIL_CLASS_B, 'B'),
            (SOIL_CLASS_C, 'C'),
            (SOIL_CLASS_D, 'D'),
            (SOIL_CLASS_E, 'E')
        )

        soil_class = models.CharField(max_length=1,
                                      choices=SOIL_CLASS_CHOICES,
                                      default=SOIL_CLASS_A)
        period = models.FloatField(default=1.5)
        location = models.ForeignKey(Location, on_delete=PROTECT, 
null=False)

...and a test script that creates an NZ_Standard_Curve, and tries to save 
it:

        location = Location.objects.get(location='Christchurch')
        curve = NZ_Standard_Curve(location=location, 
                                   soil_class='C',
                                   period=1.5)
        curve.save()

If I don't try to save the curve, the test passes. The save() call fails 
with:

    sqlite3.OperationalError: no such table: main.slat_location

Again, this all works with django 1.11.13. I've tried creating a fresh 
database, and making new migrations, but that hasn't helped. 

I've wondered if the leading 'main.' in the table name is a clue, but that 
hasn't led me anywhere yet.

Any suggestions? 

Kind Regards,
Michael Gauland

-- 
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/7f89596e-c7f0-44ff-a13f-a5779701a80a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to