88from . import PREFIX , CONN_INFO
99import datetime
1010import numpy as np
11+ import uuid
12+ from .schema_uuid import Topic , Item , top_level_namespace_id
1113schema = dj .Schema (PREFIX + '_aggr_regress' , connection = dj .conn (** CONN_INFO ))
1214
1315# --------------- ISSUE 386 -------------------
@@ -95,38 +97,6 @@ class X(dj.Lookup):
9597 contents = zip (range (10 ))
9698
9799
98- @schema
99- class Parent (dj .Manual ):
100- definition = """
101- # Parent table
102- id: int
103- ---
104- txt = "NA" : varchar(32)
105- """
106-
107-
108- @schema
109- class Child (dj .Computed ):
110- definition = """
111- # Child table
112- -> Parent
113- start_time: datetime(6)
114- ---
115- timestamps: longblob
116- """
117-
118- def make (self , key ):
119- t = np .random .poisson (1000 , 10 )
120- t .sort ()
121- self .insert1 (
122- {
123- "start_time" : datetime .datetime .now (),
124- "timestamps" : t ,
125- ** key ,
126- }
127- )
128- print (f"ingested w/ { key } " )
129-
130100def test_issue558_part1 ():
131101 q = (A - B ).proj (id2 = '3' )
132102 assert_equal (len (A - B ), len (q ))
@@ -138,9 +108,11 @@ def test_issue558_part2():
138108
139109
140110def test_left_join_len ():
141- Parent .insert1 ({"id" : 1 })
142- Child .populate ()
143- Parent .insert ([{"id" : 2 }, {"id" : 3 }, {"id" : 4 }])
144- q = Parent .join (Child & "id != 1" , left = True )
111+ Topic ().add ('jeff' )
112+ Item .populate ()
113+ Topic ().add ('jeff2' )
114+ Topic ().add ('jeff3' )
115+ q = Topic .join (Item - dict (topic_id = uuid .uuid5 (top_level_namespace_id , 'jeff' )),
116+ left = True )
145117 qf = q .fetch ()
146118 assert len (q ) == len (qf )
0 commit comments