We will use the design produced in 004-Design. Please execute that notebook first to define and populate the app
schema.
Recall the design¶
The following code connects to the app
schema and generates Python classes to access its classes.
import datajoint as dj
schema = dj.Schema('app')
schema.spawn_missing_classes()
dj.Diagram(schema)
Loading...
Purchase()
Loading...
Account * AddOn
Loading...
Account * AddOn & 'sex="F"'
Loading...
dj.Diagram(schema)
Loading...
Purchase * AddOn
Loading...
Purchase * AddOn
Loading...
@schema
class Person(dj.Manual):
definition = """
person_id : int
---
full_name : varchar(60)
"""
@schema
class Dependent(dj.Manual):
definition = """
-> Person
-> Person.proj(provider_id="person_id")
"""
dj.Diagram(schema)
Loading...
Person.insert((
(1, "Bob"),
(2, "Anne"),
(3, "Dave"),
(4, "Carol")
))
Dependent.insert1((2, 1))
Dependent.insert1((3, 1))
Dependent.insert1((4, 2))
Person * Dependent * Person.proj(provider_id="person_id", provider_full_name="full_name")
Loading...