Skip to content

Commit bab8d1e

Browse files
Add decimal(n,f) to core types (Tier 2)
Add fixed-point decimal as a core DataJoint type, allowing it to be recorded in field comments using :type: syntax for reconstruction. This provides scientists with a standardized type for exact numeric precision use cases (financial data, coordinates, etc.). Co-authored-by: dimitri-yatsenko <dimitri@datajoint.com>
1 parent 164e7cc commit bab8d1e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

docs/src/design/tables/storage-types-spec.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ MySQL and PostgreSQL backends. Users should prefer these over native database ty
6666
| `uint64` | 64-bit unsigned | `BIGINT UNSIGNED` |
6767
| `float32` | 32-bit float | `FLOAT` |
6868
| `float64` | 64-bit float | `DOUBLE` |
69+
| `decimal(n,f)` | Fixed-point | `DECIMAL(n,f)` |
6970

7071
### String Types
7172

src/datajoint/declare.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
"varchar": (r"varchar\s*\(\d+\)$", None),
4545
# Enumeration
4646
"enum": (r"enum\s*\(.+\)$", None),
47+
# Fixed-point decimal
48+
"decimal": (r"decimal\s*\(\d+\s*,\s*\d+\)$", None),
4749
}
4850

4951
# Compile core type patterns

0 commit comments

Comments
 (0)