Skip to content

Commit b6be218

Browse files
committed
Remove backticks from lineage format in spec
Lineage strings now use plain dot notation: schema.table.attribute instead of quoted format: `schema`.`table`.`attribute`
1 parent 37f6e58 commit b6be218

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/src/design/semantic-matching-spec.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ Consider two tables:
6363
Lineage identifies the **origin** of an attribute - where it was first defined. It is represented as a string in the format:
6464

6565
```
66-
`schema_name`.`table_name`.`attribute_name`
66+
schema_name.table_name.attribute_name
6767
```
6868

6969
#### Lineage Assignment Rules
7070

7171
1. **Native primary key attributes** have lineage:
7272
```
73-
lineage = "`this_schema`.`this_table`.`attr_name`"
73+
lineage = "this_schema.this_table.attr_name"
7474
```
7575
The table where they are originally defined.
7676

7777
2. **Attributes inherited via foreign key** retain their origin lineage:
7878
```
79-
lineage = "`parent_schema`.`parent_table`.`attr_name`"
79+
lineage = "parent_schema.parent_table.attr_name"
8080
```
8181
Traced to the original definition through the FK chain.
8282

@@ -234,7 +234,7 @@ def compute_lineage(table, attribute):
234234

235235
# Not inherited - check if primary key
236236
if attribute in table.primary_key:
237-
return f"`{schema}`.`{table}`.`{attribute}`"
237+
return f"{schema}.{table}.{attribute}"
238238

239239
# Native secondary - no lineage
240240
return None
@@ -261,7 +261,7 @@ Add `lineage` field to the `Attribute` namedtuple:
261261
```python
262262
default_attribute_properties = dict(
263263
# ... existing fields ...
264-
lineage=None, # NEW: Origin of attribute, e.g. "`schema`.`table`.`attr`"
264+
lineage=None, # NEW: Origin of attribute, e.g. "schema.table.attr"
265265
)
266266
```
267267

@@ -365,7 +365,7 @@ def declare_table(table_class, context):
365365
# Native primary key: this table is the origin
366366
lineage_entries.append((
367367
table_name, attr.name,
368-
f"`{schema}`.`{table_name}`.`{attr.name}`"
368+
f"{schema}.{table_name}.{attr.name}"
369369
))
370370
else:
371371
# Native secondary: no lineage
@@ -422,7 +422,7 @@ Union requires all namesake attributes to have matching lineage (enforced via `a
422422

423423
```
424424
DataJointError: Cannot join on attribute `id`: different lineages
425-
(`university`.`Student`.`id` vs `university`.`Course`.`id`).
425+
(university.Student.id vs university.Course.id).
426426
Use .proj() to rename one of the attributes.
427427
```
428428

@@ -544,7 +544,7 @@ Query cache keys should include lineage information to prevent cache collisions
544544
For schemas spanning multiple databases, lineage format may need to include database identifier:
545545

546546
```
547-
`database`.`schema`.`table`.`attribute`
547+
database.schema.table.attribute
548548
```
549549

550550
### Lineage Visualization
@@ -564,11 +564,11 @@ Response(session_id*, trial_num*, response_time)
564564
```
565565

566566
Lineages:
567-
- `Session.session_id``"university"."Session"."session_id"`
568-
- `Trial.session_id``"university"."Session"."session_id"` (inherited)
569-
- `Trial.trial_num``"university"."Trial"."trial_num"` (native PK)
570-
- `Response.session_id``"university"."Session"."session_id"` (inherited)
571-
- `Response.trial_num``"university"."Trial"."trial_num"` (inherited)
567+
- `Session.session_id``university.Session.session_id`
568+
- `Trial.session_id``university.Session.session_id` (inherited)
569+
- `Trial.trial_num``university.Trial.trial_num` (native PK)
570+
- `Response.session_id``university.Session.session_id` (inherited)
571+
- `Response.trial_num``university.Trial.trial_num` (inherited)
572572

573573
### Example 2: Secondary FK
574574

@@ -579,9 +579,9 @@ Enrollment(student_id*, course_id)
579579
```
580580

581581
Lineages:
582-
- `Course.course_id``"university"."Course"."course_id"`
583-
- `Enrollment.student_id``"university"."Enrollment"."student_id"` (native PK)
584-
- `Enrollment.course_id``"university"."Course"."course_id"` (inherited via FK)
582+
- `Course.course_id``university.Course.course_id`
583+
- `Enrollment.student_id``university.Enrollment.student_id` (native PK)
584+
- `Enrollment.course_id``university.Course.course_id` (inherited via FK)
585585

586586
### Example 3: Aliased FK
587587

@@ -593,9 +593,9 @@ Marriage(husband*, wife*, date)
593593
```
594594

595595
Lineages:
596-
- `Person.person_id``"family"."Person"."person_id"`
597-
- `Marriage.husband``"family"."Person"."person_id"` (aliased FK)
598-
- `Marriage.wife``"family"."Person"."person_id"` (aliased FK)
596+
- `Person.person_id``family.Person.person_id`
597+
- `Marriage.husband``family.Person.person_id` (aliased FK)
598+
- `Marriage.wife``family.Person.person_id` (aliased FK)
599599

600600
Note: `husband` and `wife` have the **same lineage** even though different names.
601601

@@ -607,7 +607,7 @@ Course(id*, title) -- id is native PK
607607
```
608608

609609
Lineages:
610-
- `Student.id``"university"."Student"."id"`
611-
- `Course.id``"university"."Course"."id"`
610+
- `Student.id``university.Student.id`
611+
- `Course.id``university.Course.id`
612612

613613
`Student * Course`**Error**: non-homologous namesakes (`id` has different lineages)

0 commit comments

Comments
 (0)