Skip to content

Commit 6fefbf6

Browse files
committed
docs: add documentation for numeric type aliases
Document the new type aliases (float32, float64, int8-64, uint8-64) in the datatypes documentation with a table of mappings and example usage.
1 parent 36a553a commit 6fefbf6

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/src/design/tables/attributes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,40 @@ sending/receiving an opaque data file to/from a DataJoint pipeline.
7777
- `filepath@store`: a [filepath](filepath.md) used to link non-DataJoint managed files
7878
into a DataJoint pipeline.
7979

80+
## Numeric type aliases
81+
82+
DataJoint provides convenient type aliases that map to standard MySQL numeric types.
83+
These aliases use familiar naming conventions from NumPy and other numerical computing
84+
libraries, making table definitions more readable and explicit about data precision.
85+
86+
| Alias | MySQL Type | Description |
87+
|-------|------------|-------------|
88+
| `int8` | `tinyint` | 8-bit signed integer (-128 to 127) |
89+
| `uint8` | `tinyint unsigned` | 8-bit unsigned integer (0 to 255) |
90+
| `int16` | `smallint` | 16-bit signed integer (-32,768 to 32,767) |
91+
| `uint16` | `smallint unsigned` | 16-bit unsigned integer (0 to 65,535) |
92+
| `int32` | `int` | 32-bit signed integer |
93+
| `uint32` | `int unsigned` | 32-bit unsigned integer |
94+
| `int64` | `bigint` | 64-bit signed integer |
95+
| `uint64` | `bigint unsigned` | 64-bit unsigned integer |
96+
| `float32` | `float` | 32-bit single-precision floating point |
97+
| `float64` | `double` | 64-bit double-precision floating point |
98+
99+
Example usage:
100+
101+
```python
102+
@schema
103+
class Measurement(dj.Manual):
104+
definition = """
105+
measurement_id : int
106+
---
107+
temperature : float32 # single-precision temperature reading
108+
precise_value : float64 # double-precision measurement
109+
sample_count : uint32 # unsigned 32-bit counter
110+
sensor_flags : uint8 # 8-bit status flags
111+
"""
112+
```
113+
80114
## Datatypes not (yet) supported
81115

82116
- `binary`

0 commit comments

Comments
 (0)