Skip to content

Commit b646924

Browse files
authored
add jsonfield support for sql managed instance (#198)
1 parent 3ada07b commit b646924

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mssql/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from .schema import DatabaseSchemaEditor # noqa
4242

4343
EDITION_AZURE_SQL_DB = 5
44-
44+
EDITION_AZURE_SQL_MANAGED_INSTANCE = 8
4545

4646
def encode_connection_string(fields):
4747
"""Encode dictionary of keys and values as an ODBC connection String.
@@ -483,7 +483,8 @@ def to_azure_sql_db(self, _known_azures={}):
483483
if self.alias not in _known_azures:
484484
with self.temporary_connection() as cursor:
485485
cursor.execute("SELECT CAST(SERVERPROPERTY('EngineEdition') AS integer)")
486-
_known_azures[self.alias] = cursor.fetchone()[0] == EDITION_AZURE_SQL_DB
486+
edition = cursor.fetchone()[0]
487+
_known_azures[self.alias] = edition == EDITION_AZURE_SQL_DB or edition == EDITION_AZURE_SQL_MANAGED_INSTANCE
487488
return _known_azures[self.alias]
488489

489490
def _execute_foreach(self, sql, table_names=None):

0 commit comments

Comments
 (0)