Remove unsigned integer types from core types #1335
Merged
+37
−45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Remove unsigned integer types (
uint8,uint16,uint32,uint64) from DataJoint's core type system for v2.0. These types are MySQL-specific and not portable to PostgreSQL and other database backends.Motivation
DataJoint 2.0 is in pre-release and aims to support multiple database backends (PostgreSQL support coming in v2.1). Unsigned integer types only exist in MySQL, creating portability issues:
INTEGER)Since v2.0 already requires migration from 0.14.6, this is the ideal time to establish a clean, portable core type system.
Changes
Implementation (
src/datajoint/declare.py)uint8,uint16,uint32,uint64fromCORE_TYPESdictionaryTests (6 files updated)
Replaced all unsigned core types with signed equivalents:
uint8→int16(larger signed type for unsigned 8-bit range)uint16→int32(larger signed type for unsigned 16-bit range)uint32→int64(larger signed type for unsigned 32-bit range)Files:
tests/schema_simple.py- E.M.id_mtests/schema_type_aliases.py- Removed unsigned types from test tabletests/schema.py- Auto.id, Ephys.Channel.channeltests/schema_university.py- Student.student_id, Course.coursetests/integration/test_type_aliases.py- Removed unsigned type test casestests/integration/test_hidden_job_metadata.py- All uint8 → int16Note:
test_blob.pyandtest_blob_matlab.pyunchanged (testing numpy dtypes in serialization, not DataJoint table definitions).Migration Path
OLD (0.14.6, no longer works in 2.0):
NEW (2.0, portable):
Alternative (MySQL-only, not portable):
Core Types After This Change
Signed integers only:
int8→TINYINTint16→SMALLINTint32→INTint64→BIGINTUnsigned removed:
❌ REMOVEDuint8❌ REMOVEDuint16❌ REMOVEDuint32❌ REMOVEDuint64Users who need unsigned integers must use native MySQL types like
tinyint unsigned,int unsigned, etc., which will trigger warnings about non-portable types.Impact
Who is affected:
uint8,uint16,uint32,uint64core typesMigration:
mouse_id : uint32→mouse_id : int64Why this is acceptable:
Related
pre/v2.1)PROPOSAL_CORE_TYPES_REVISION.mdfor full rationaleTesting