Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sql_server/pyodbc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,22 @@ class DatabaseWrapper(BaseDatabaseWrapper):
'NullBooleanField': 'bit',
'OneToOneField': 'int',
'PositiveIntegerField': 'int',
'PositiveTinyIntegerField': 'tinyint',
'PositiveSmallIntegerField': 'smallint',
'PositiveBigIntegerField': 'bigint',
'SlugField': 'nvarchar(%(max_length)s)',
'SmallAutoField': 'smallint IDENTITY (1, 1)',
'SmallIntegerField': 'smallint',
'TinyAutoField': 'tinyint IDENTITY (1, 1)',
'TinyIntegerField': 'tinyint',
'TextField': 'nvarchar(max)',
'TimeField': 'time',
'UUIDField': 'char(32)',
'JSONField': 'nvarchar(max)',
}
data_type_check_constraints = {
'PositiveIntegerField': '[%(column)s] >= 0',
'PositiveTinyIntegerField': '[%(column)s] >= 0',
'PositiveSmallIntegerField': '[%(column)s] >= 0',
}
operators = {
Expand Down
15 changes: 15 additions & 0 deletions sql_server/pyodbc/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@
class DatabaseOperations(BaseDatabaseOperations):
compiler_module = 'sql_server.pyodbc.compiler'

integer_field_ranges = {
'TinyIntegerField': (-128, 127),
'SmallIntegerField': (-32768, 32767),
'IntegerField': (-2147483648, 2147483647),
'BigIntegerField': (-9223372036854775808, 9223372036854775807),
'PositiveBigIntegerField': (0, 9223372036854775807),
'PositiveSmallIntegerField': (0, 32767),
'PositiveTinyIntegerField': (0, 127),
'PositiveIntegerField': (0, 2147483647),
'TinyAutoField': (-128, 127),
'SmallAutoField': (-32768, 32767),
'AutoField': (-2147483648, 2147483647),
'BigAutoField': (-9223372036854775808, 9223372036854775807),
}

cast_char_field_without_max_length = 'nvarchar(max)'

def _convert_field_to_tz(self, field_name, tzname):
Expand Down