Skip to content

Commit 8486cb0

Browse files
authored
Merge pull request #10 from grongierisc/main
fix introspection to fulfill display_size
2 parents dcc52a5 + b247610 commit 8486cb0

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Prerequisites
99
You must install, the latest version of InterSystems IRIS DB-API Python driver
1010

1111
```shell
12-
pip3 install intersystems_irispython-3.2.0-py3-none-any.whl
12+
pip3 install https://github.com/intersystems-community/intersystems-irispython/releases/download/3.7.3/intersystems_iris-3.7.3-py3-none-any.whl
1313
```
1414

1515
Install and usage

django_iris/introspection.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from django.db.models import Index
77
from django.utils.datastructures import OrderedSet
88

9+
MAXLEN = 65535
10+
911
FieldInfo = namedtuple(
1012
'FieldInfo', BaseFieldInfo._fields + ('auto_increment', ))
1113

@@ -94,10 +96,9 @@ def get_table_description(self, cursor, table_name):
9496
description = [
9597
FieldInfo(
9698
name,
97-
'longvarchar'
98-
if data_type == 'varchar' and length == '-1' else data_type,
99-
None,
100-
length,
99+
'longvarchar' if data_type == 'varchar' and length == '-1' else data_type,
100+
MAXLEN if not isinstance(length, int) or data_type != 'varchar' else length,
101+
MAXLEN if not isinstance(length, int) or data_type != 'varchar' else length,
101102
precision,
102103
scale,
103104
isnull == 'YES',

django_iris/operations.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
from datetime import date, datetime,timedelta
99
from django.utils.encoding import force_str
1010
from django.utils.dateparse import parse_date, parse_datetime, parse_time
11-
from django.db.backends.base.base import timezone_constructor
11+
try:
12+
from django.db.backends.base.base import timezone_constructor # Django 4.2
13+
except ImportError:
14+
from django.utils.timezone import timezone as timezone_constructor # Django 5+
1215

1316
from .utils import BulkInsertMapper
1417

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/intersystems-community/intersystems-irispython/releases/download/3.6.3/intersystems_iris-3.6.3-py3-none-any.whl
1+
https://github.com/intersystems-community/intersystems-irispython/releases/download/3.7.3/intersystems_iris-3.7.3-py3-none-any.whl

0 commit comments

Comments
 (0)