Skip to content

Commit 524e578

Browse files
Merge pull request #672 from ixcat/master
Allow disabling packing python native datatypes in blobs
2 parents ed7cf6a + c4e0de8 commit 524e578

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

datajoint/blob.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import numpy as np
1313
from .errors import DataJointError
1414
from .utils import OrderedDict
15+
from .settings import config
1516

1617

1718
mxClassID = OrderedDict((
@@ -71,6 +72,9 @@ def __init__(self, squeeze=False):
7172
self.protocol = None
7273

7374
def set_dj0(self):
75+
if not config.get('enable_python_native_blobs'):
76+
raise DataJointError('v0.12+ python native blobs disabled. see also: https://github.com/datajoint/datajoint-python/blob/master/README.md')
77+
7478
self.protocol = b"dj0\0" # when using new blob features
7579

7680
def squeeze(self, array, convert_to_scalar=True):

datajoint/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
'display.limit': 12,
4444
'display.width': 14,
4545
'display.show_tuple_count': True,
46-
'database.use_tls': None
46+
'database.use_tls': None,
47+
'enable_python_native_blobs': False, # python-native/dj0 encoding support
4748
})
4849

4950
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)