@@ -127,7 +127,8 @@ DataJoint 2.0 replaces `external.*` with unified `stores.*` configuration:
127127| ` (table & key)._update('attr', val) ` | ` table.update1({**key, 'attr': val}) ` | I |
128128| ` table1 @ table2 ` | ` table1 * table2 ` (natural join with semantic checks) | I |
129129| ` a.join(b, left=True) ` | Consider ` a.extend(b) ` | I |
130- | ` dj.U('attr') * table ` | ` table ` (no longer necessary) | I |
130+ | ` dj.U('attr') & table ` | Unchanged (correct pattern) | — |
131+ | ` dj.U('attr') * table ` | Refactor (was a hack to change primary key) | I |
131132| ` dj.ERD(schema) ` | ` dj.Diagram(schema) ` | I |
132133
133134** Learn more:** [ Fetch API Reference] ( ../reference/specs/fetch-api.md ) · [ Query Operators Reference] ( ../reference/operators.md )
@@ -741,7 +742,10 @@ Update all DataJoint API calls to 2.0 patterns.
741742** Join Operators:**
742743- ` table1 @ table2 ` → ` table1 * table2 ` (natural join with semantic checks enabled)
743744- ` a.join(b, left=True) ` → Consider ` a.extend(b) `
744- - ` dj.U('attr') * table ` → ` table ` (no longer necessary)
745+
746+ ** Universal Set:**
747+ - ` dj.U('attr') & table ` → Unchanged (correct pattern for projecting attributes)
748+ - ` dj.U('attr') * table ` → Refactor (was a hack to change primary key)
745749
746750** Visualization:**
747751- ` dj.ERD(schema) ` → ` dj.Diagram(schema) ` (ERD deprecated)
@@ -804,9 +808,14 @@ API CONVERSIONS:
804808 OLD: result = a.join(b, left=True)
805809 NEW: result = a.extend(b) # Consider using extend for left joins
806810
807- 4. Universal Set (REMOVE - no longer necessary):
808- OLD: result = dj.U('attr') * table
809- NEW: result = table # dj.U() is no longer necessary
811+ 4. Universal Set (CHECK - distinguish correct from hack):
812+ CORRECT (unchanged):
813+ result = dj.U('attr') & table # Projects specific attributes, keeps as is
814+
815+ HACK (refactor):
816+ result = dj.U('attr') * table # Was used to change primary key, needs refactoring
817+
818+ Note: The * operator with dj.U() was a hack. Ask user about intent and suggest proper refactoring.
810819
8118205. Insert/Delete (unchanged):
812821 table.insert(data) # unchanged
@@ -823,7 +832,8 @@ PROCESS:
823832 d. Replace with update1()
824833 e. Search for @ operator (replace with * for natural join)
825834 f. Search for .join(x, left=True) patterns (consider .extend(x))
826- g. Search for dj.U() * patterns (remove, replace with just table)
835+ g. Search for dj.U() * patterns (identify as hack, ask user to refactor)
836+ h. Verify dj.U() & patterns remain unchanged
8278373. Run syntax checks
8288384. Run existing tests if available
8298395. If semantic checks fail after @ → * conversion, investigate schema/data
@@ -834,7 +844,8 @@ VERIFICATION:
834844- No .fetch1('KEY') calls remaining (replaced with .keys())
835845- No ._update() calls remaining
836846- No @ operator between tables
837- - No dj.U() * patterns (removed)
847+ - dj.U() * patterns identified and flagged for refactoring
848+ - dj.U() & patterns remain unchanged
838849- All tests pass (if available)
839850- Semantic check failures investigated and resolved
840851
@@ -876,31 +887,41 @@ Pattern 9: Left join
876887OLD: result = Session.join(Experiment, left=True)
877888NEW: result = Session.extend(Experiment) # Consider using extend
878889
879- Pattern 10: Universal set (REMOVE)
880- OLD: all_dates = dj.U('session_date') * Session
881- NEW: all_dates = Session # dj.U() no longer necessary
890+ Pattern 10: Universal set (distinguish correct from hack)
891+ CORRECT (unchanged):
892+ OLD: all_dates = dj.U('session_date') & Session
893+ NEW: all_dates = dj.U('session_date') & Session # Unchanged, correct pattern
894+
895+ HACK (needs refactoring):
896+ OLD: result = dj.U('new_pk') * Session # Hack to change primary key
897+ NEW: [Refactor - ask user about intent]
882898
883899REPORT:
884900
885901- Files modified: [list]
886902- fetch() → to_arrays/to_dicts: [count]
903+ - fetch(..., format="frame") → to_pandas(): [count]
887904- fetch1('KEY') → keys(): [count]
888905- _update() → update1(): [count]
889906- @ → * (natural join): [count]
890907- .join(x, left=True) → .extend(x): [count]
891- - dj.U() * table → table (removed): [count]
908+ - dj.U() * table patterns flagged for refactoring: [count]
909+ - dj.U() & table patterns (unchanged): [count]
910+ - dj.ERD() → dj.Diagram(): [count]
892911- Semantic check failures: [count and resolution]
893912- Tests passed: [yes/no]
894913
895914COMMIT MESSAGE FORMAT:
896915"feat(phase-i): convert query and insert code to 2.0 API
897916
898- - Replace fetch() with to_arrays()/to_dicts()
917+ - Replace fetch() with to_arrays()/to_dicts()/to_pandas()
899918- Replace fetch1('KEY') with keys()
900919- Replace _update() with update1()
901920- Replace @ operator with * (enables semantic checks)
902921- Replace .join(x, left=True) with .extend(x)
903- - Remove dj.U() * table patterns (no longer necessary)
922+ - Replace dj.ERD() with dj.Diagram()
923+ - Flag dj.U() * table patterns as hacks needing refactoring
924+ - Keep dj.U() & table patterns unchanged (correct)
904925- Investigate and resolve semantic check failures
905926
906927API conversions: X fetch, Y update, Z join"
@@ -1024,7 +1045,8 @@ Tables updated: X Computed, Y Imported"
10241045- [ ] All ` fetch1('KEY') ` converted to ` keys() `
10251046- [ ] All ` ._update() ` calls converted
10261047- [ ] All ` @ ` operators converted to ` * `
1027- - [ ] All ` dj.U() * table ` patterns removed (replace with ` table ` )
1048+ - [ ] All ` dj.U() * table ` patterns flagged for refactoring (was a hack)
1049+ - [ ] All ` dj.U() & table ` patterns verified as unchanged (correct)
10281050- [ ] All ` dj.ERD() ` calls converted to ` dj.Diagram() `
10291051- [ ] All populate methods updated
10301052- [ ] No syntax errors
0 commit comments