@@ -25,14 +25,14 @@ Semantic matching is enabled by default in DataJoint 2.0. For most well-designed
2525# Two tables with generic 'id' attribute
2626class Student (dj .Manual ):
2727 definition = """
28- id : int
28+ id : uint32
2929 ---
3030 name : varchar(100)
3131 """
3232
3333class Course (dj .Manual ):
3434 definition = """
35- id : int
35+ id : uint32
3636 ---
3737 title : varchar(100)
3838 """
@@ -57,7 +57,7 @@ Student().join(Course(), semantic_check=False) # OK, but be careful!
5757``` python
5858class Student (dj .Manual ):
5959 definition = """
60- student_id : int
60+ student_id : uint32
6161 ---
6262 name : varchar(100)
6363 """
@@ -235,23 +235,23 @@ schema_name.table_name.attribute_name
235235``` python
236236class Session (dj .Manual ): # table: session
237237 definition = """
238- session_id : int
238+ session_id : uint32
239239 ---
240- date : date
240+ session_date : date
241241 """
242242
243243class Trial (dj .Manual ): # table: trial
244244 definition = """
245245 -> Session
246- trial_num : int
246+ trial_num : uint16
247247 ---
248248 stimulus : varchar(100)
249249 """
250250```
251251
252252Lineages:
253253- ` Session.session_id ` → ` myschema.session.session_id ` (native PK)
254- - ` Session.date ` → ` None ` (native secondary)
254+ - ` Session.session_date ` → ` None ` (native secondary)
255255- ` Trial.session_id ` → ` myschema.session.session_id ` (inherited via FK)
256256- ` Trial.trial_num ` → ` myschema.trial.trial_num ` (native PK)
257257- ` Trial.stimulus ` → ` None ` (native secondary)
@@ -385,7 +385,7 @@ run schema.rebuild_lineage() on this schema to correct the lineage.
385385``` python
386386class Student (dj .Manual ):
387387 definition = """
388- student_id : int
388+ student_id : uint32
389389 ---
390390 name : varchar(100)
391391 """
@@ -407,16 +407,16 @@ Student() * Enrollment()
407407``` python
408408class TableA (dj .Manual ):
409409 definition = """
410- id : int
410+ id : uint32
411411 ---
412- value_a : int
412+ value_a : int32
413413 """
414414
415415class TableB (dj .Manual ):
416416 definition = """
417- id : int
417+ id : uint32
418418 ---
419- value_b : int
419+ value_b : int32
420420 """
421421
422422# Error: 'id' has different lineages
@@ -434,22 +434,22 @@ TableA().join(TableB(), semantic_check=False)
434434``` python
435435class Session (dj .Manual ):
436436 definition = """
437- session_id : int
437+ session_id : uint32
438438 ---
439- date : date
439+ session_date : date
440440 """
441441
442442class Trial (dj .Manual ):
443443 definition = """
444444 -> Session
445- trial_num : int
445+ trial_num : uint16
446446 """
447447
448448class Response (dj .Computed ):
449449 definition = """
450450 -> Trial
451451 ---
452- response_time : float
452+ response_time : float64
453453 """
454454
455455# All work: session_id traces back to Session in all tables
@@ -463,21 +463,21 @@ Trial() * Response()
463463``` python
464464class Course (dj .Manual ):
465465 definition = """
466- course_id : int
466+ course_id : int unsigned
467467 ---
468468 title : varchar(100)
469469 """
470470
471471class FavoriteCourse (dj .Manual ):
472472 definition = """
473- student_id : int
473+ student_id : int unsigned
474474 ---
475475 -> Course
476476 """
477477
478478class RequiredCourse (dj .Manual ):
479479 definition = """
480- major_id : int
480+ major_id : int unsigned
481481 ---
482482 -> Course
483483 """
@@ -491,17 +491,17 @@ FavoriteCourse() * RequiredCourse()
491491``` python
492492class Person (dj .Manual ):
493493 definition = """
494- person_id : int
494+ person_id : int unsigned
495495 ---
496- name : varchar(100)
496+ full_name : varchar(100)
497497 """
498498
499499class Marriage (dj .Manual ):
500500 definition = """
501501 -> Person.proj(husband='person_id')
502502 -> Person.proj(wife='person_id')
503503 ---
504- date : date
504+ marriage_date : date
505505 """
506506
507507# husband and wife both have lineage: schema.person.person_id
0 commit comments