From 429d51030cb11710783c46831e91c38c644d9a70 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Fri, 16 Jan 2026 16:29:02 -0600 Subject: [PATCH 1/3] term: replace 'antijoin' with canonical 'anti-restriction' terminology - Changed 'Antijoin' to 'Anti-restriction' in cell 18 comment - Updated operator reference table in cell 35 - Aligns with TERMINOLOGY.md canonical terms --- src/tutorials/advanced/sql-comparison.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tutorials/advanced/sql-comparison.ipynb b/src/tutorials/advanced/sql-comparison.ipynb index 267a5cef..5d08bffd 100644 --- a/src/tutorials/advanced/sql-comparison.ipynb +++ b/src/tutorials/advanced/sql-comparison.ipynb @@ -1235,7 +1235,7 @@ "# Restriction: filters Session to rows matching the Subject query \n", "Session & (Subject & {'species': 'mouse'})\n", "\n", - "# Antijoin: Session rows NOT matching any Subject (none here, all subjects exist)\n", + "# Anti-restriction: Session rows NOT matching any Subject (none here, all subjects exist)\n", "Session - Subject" ] }, @@ -2583,7 +2583,7 @@ "| `WHERE condition` | `& {'col': value}` or `& 'expr'` | Restriction |\n", "| `JOIN ... USING` | `Table1 * Table2` | Natural join |\n", "| `GROUP BY ... AGG()` | `.aggr(Table, alias='agg()')` | Aggregation |\n", - "| `NOT IN (subquery)` | `Table1 - Table2` | Antijoin |\n", + "| `NOT IN (subquery)` | `Table1 - Table2` | Anti-restriction |\n", "| `UNION` | `Table1 + Table2` | Union |" ] }, From 29bb489ef60753a7696d805263e5f94940efc117 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Fri, 16 Jan 2026 16:30:20 -0600 Subject: [PATCH 2/3] docs: replace native 'int' with core type 'uint16' in custom-codecs tutorial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed conn_id : int → conn_id : uint16 in Connectivity table - Changed unit_id : int → unit_id : uint16 in Unit table - Python dataclass SpikeTrain.unit_id: int unchanged (Python type, not DJ type) - Aligns with core type standards from TERMINOLOGY.md --- src/tutorials/advanced/custom-codecs.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tutorials/advanced/custom-codecs.ipynb b/src/tutorials/advanced/custom-codecs.ipynb index 1dc280f7..cfa78be8 100644 --- a/src/tutorials/advanced/custom-codecs.ipynb +++ b/src/tutorials/advanced/custom-codecs.ipynb @@ -113,7 +113,7 @@ "@schema\n", "class Connectivity(dj.Manual):\n", " definition = \"\"\"\n", - " conn_id : int\n", + " conn_id : uint16\n", " ---\n", " network : \n", " \"\"\"" @@ -253,7 +253,7 @@ "@schema\n", "class Unit(dj.Manual):\n", " definition = \"\"\"\n", - " unit_id : int\n", + " unit_id : uint16\n", " ---\n", " spikes : \n", " \"\"\"\n", @@ -304,4 +304,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file From aab23f6ce6dfdfd910123070bc35746b261f3292 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Fri, 16 Jan 2026 16:49:45 -0600 Subject: [PATCH 3/3] docs: fix custom codec examples - use correct storage types and is_store parameter - Replace is_external with is_store throughout - Replace with for external blob storage - Replace with for schema-addressed storage - Update documentation to reflect correct codec API --- src/explanation/custom-codecs.md | 34 +++++++++++++++---------------- src/how-to/create-custom-codec.md | 10 ++++----- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/explanation/custom-codecs.md b/src/explanation/custom-codecs.md index 5fefbc28..6d9f2f28 100644 --- a/src/explanation/custom-codecs.md +++ b/src/explanation/custom-codecs.md @@ -42,7 +42,7 @@ class MyCodec(dj.Codec): """Store custom objects.""" name = "mytype" # Used as in definitions - def get_dtype(self, is_external: bool) -> str: + def get_dtype(self, is_store: bool) -> str: """Return storage type.""" return "" # Chain to blob serialization @@ -78,9 +78,9 @@ class GraphCodec(dj.Codec): """Store NetworkX graphs as adjacency data.""" name = "graph" - def get_dtype(self, is_external: bool) -> str: - # Store as blob (internal) or hash-addressed (external) - return "" if is_external else "" + def get_dtype(self, is_store: bool) -> str: + # Store as blob (internal) or blob@ (external) + return "" if is_store else "" def encode(self, graph, *, key=None, store_name=None): """Serialize graph to dict.""" @@ -136,10 +136,10 @@ class BamCodec(dj.Codec): """Store BAM alignments.""" name = "bam" - def get_dtype(self, is_external: bool) -> str: - if not is_external: + def get_dtype(self, is_store: bool) -> str: + if not is_store: raise dj.DataJointError(" requires external storage: use ") - return "" # Path-addressed storage for file structure + return "" # Path-addressed storage for file structure def encode(self, alignments, *, key=None, store_name=None): """Write alignments to BAM format.""" @@ -162,8 +162,8 @@ class MedicalImageCodec(dj.Codec): """Store medical images with metadata.""" name = "medimg" - def get_dtype(self, is_external: bool) -> str: - return "" if is_external else "" + def get_dtype(self, is_store: bool) -> str: + return "" if is_store else "" def encode(self, image, *, key=None, store_name=None): """Serialize SimpleITK image.""" @@ -197,7 +197,7 @@ graph LR class CompressedGraphCodec(dj.Codec): name = "cgraph" - def get_dtype(self, is_external: bool) -> str: + def get_dtype(self, is_store: bool) -> str: return "" # Chain to graph codec def encode(self, graph, *, key=None, store_name=None): @@ -216,8 +216,8 @@ class CompressedGraphCodec(dj.Codec): class SmallDataCodec(dj.Codec): name = "small" - def get_dtype(self, is_external: bool) -> str: - if is_external: + def get_dtype(self, is_store: bool) -> str: + if is_store: raise dj.DataJointError(" is internal-only") return "json" ``` @@ -228,10 +228,10 @@ class SmallDataCodec(dj.Codec): class LargeDataCodec(dj.Codec): name = "large" - def get_dtype(self, is_external: bool) -> str: - if not is_external: + def get_dtype(self, is_store: bool) -> str: + if not is_store: raise dj.DataJointError(" requires @: use ") - return "" + return "" ``` ### Both Modes @@ -240,8 +240,8 @@ class LargeDataCodec(dj.Codec): class FlexibleCodec(dj.Codec): name = "flex" - def get_dtype(self, is_external: bool) -> str: - return "" if is_external else "" + def get_dtype(self, is_store: bool) -> str: + return "" if is_store else "" ``` ## Validation diff --git a/src/how-to/create-custom-codec.md b/src/how-to/create-custom-codec.md index fd2ac487..fcdd93be 100644 --- a/src/how-to/create-custom-codec.md +++ b/src/how-to/create-custom-codec.md @@ -58,16 +58,16 @@ Return the storage type: ```python def get_dtype(self, is_store: bool) -> str: if is_store: - return "" # Hash-addressed storage - return "bytes" # Inline database blob + return "" # Blob in object storage + return "bytes" # Inline database blob ``` Common return values: - `"bytes"` — Binary in database - `"json"` — JSON in database -- `""` — Chain to blob codec (hash-addressed when `@`) -- `""` — Hash-addressed storage +- `""` — Chain to blob codec (internal storage) +- `""` — Blob in object storage ### `encode(value, *, key=None, store_name=None)` @@ -135,7 +135,7 @@ class ZarrCodec(dj.Codec): def get_dtype(self, is_store: bool) -> str: if not is_store: raise DataJointError(" requires @ (store only)") - return "" # Schema-addressed storage + return "" # Schema-addressed storage def encode(self, path, *, key=None, store_name=None): return path # Path to zarr directory