Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python manage.py migrate throws error for legacy MicrosoftSQL server database having tables in different schemas #218

Open
harshacheemakurt opened this issue Jun 17, 2020 · 1 comment

Comments

@harshacheemakurt
Copy link

harshacheemakurt commented Jun 17, 2020

django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The specified
schema name "dbo" either does not exist or you do not have permission to use it. (2760) (SQLExecDirectW)'))

Note able to connect to data base and inspect db works partially

My Django models.py file

class Afactor(models.Model):
factorid = models.IntegerField(db_column='FactorId') # Field name made lowercase.
year = models.DateField(db_column='YearEnd', blank=True, null=True) # Field name made lowercase.
name = models.CharField(db_column='Name', max_length=500, blank=True, null=True) # Field name made lowercase.
factor = models.CharField(db_column='Factor', max_length=1000, blank=True, null=True) # Field name made lowercase.
tag = models.CharField(db_column='Tag', max_length=100, blank=True, null=True) # Field name made lowercase.

class Meta:
    #   * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
    managed = False
    # db_table = 'your_schema\".\"your_table'
    db_table = 'My_Schema_name].[Afactor'
@harshacheemakurt
Copy link
Author

@michiya can you please look into this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant