MSSQL get_default_schema_name is hardcoded in the dialect

Issue #1258 resolved
Former user created an issue

In the mssql dialect, the method get_default_schema_name returns the instance attribute schema_name instead of requesting the default schema from the server. It defaults to 'dbo'. If the user's default schema is not 'dbo', this method fails to return the the correct schema name.

Example:

import sqlalchemy as sa
e = sa.create_engine('mssql://scott:tiger@localhost/test')
print e.dialect.get_default_schema_name(e) # is dbo, but should be test.

I'm attaching a patch which uses an approach similar to the postgres dialect. Before the patch, with a default schema != 'dbo', one test would fail in test/dialect.mssql.py and all tests in test/engine/reflection.py failed. With the patch, all of these tests pass.

-Randall

Comments (4)

  1. Log in to comment