jupyter-duckdb 1.2.7__py3-none-any.whl → 1.2.100__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ from ...util.RenamableColumnList import RenamableColumnList
8
8
  class Difference(RABinaryOperator):
9
9
  @staticmethod
10
10
  def symbols() -> Tuple[str, ...]:
11
- return '\\',
11
+ return '-', '\\'
12
12
 
13
13
  def to_sql(self, tables: Dict[str, Table]) -> Tuple[str, RenamableColumnList]:
14
14
  # execute subqueries
@@ -8,7 +8,7 @@ class Divide(LogicOperator):
8
8
 
9
9
  @staticmethod
10
10
  def symbols() -> Tuple[str, ...]:
11
- return '÷', '/'
11
+ return '/', '÷'
12
12
 
13
13
  @property
14
14
  def sql_symbol(self) -> str:
@@ -27,10 +27,6 @@ class Division(RABinaryOperator):
27
27
  # inter_name_left = ', '.join(l.current_name for l, _ in inter_cols)
28
28
  inter_name_right = ', '.join(r.current_name for _, r in inter_cols)
29
29
 
30
- print('-', diff_name)
31
- print(inter_name)
32
- print(inter_name_right)
33
-
34
30
  # create sql
35
31
  return f'''
36
32
  SELECT {diff_name}
@@ -1,7 +1,9 @@
1
+ from typing import Optional
1
2
  from typing import Tuple, Dict
2
3
 
3
4
  from duckdb_kernel.db import Table
4
5
  from ..RABinaryOperator import RABinaryOperator
6
+ from ...util.RenamableColumn import RenamableColumn
5
7
  from ...util.RenamableColumnList import RenamableColumnList
6
8
 
7
9
 
@@ -10,6 +12,13 @@ class FullOuterJoin(RABinaryOperator):
10
12
  def symbols() -> Tuple[str, ...]:
11
13
  return chr(10199), 'fjoin', 'ojoin'
12
14
 
15
+ @staticmethod
16
+ def _coalesce(c1: RenamableColumn, c2: Optional[RenamableColumn]) -> str:
17
+ if c2 is not None:
18
+ return f'COALESCE({c1.current_name}, {c2.current_name}) AS {c1.current_name}'
19
+ else:
20
+ return c1.current_name
21
+
13
22
  def to_sql(self, tables: Dict[str, Table]) -> Tuple[str, RenamableColumnList]:
14
23
  # execute subqueries
15
24
  lq, lcols = self.left.to_sql(tables)
@@ -19,9 +28,7 @@ class FullOuterJoin(RABinaryOperator):
19
28
  join_cols, all_cols = lcols.intersect(rcols)
20
29
 
21
30
  replacements = {c1: c2 for c1, c2 in join_cols}
22
- select_cols = [
23
- f'COALESCE({c.current_name}, {replacements.get(c).current_name})' if c in replacements else c.current_name
24
- for c in all_cols]
31
+ select_cols = [self._coalesce(c, replacements.get(c)) for c in all_cols]
25
32
  select_clause = ', '.join(select_cols)
26
33
 
27
34
  on_clause = ' AND '.join(f'{l.current_name} = {r.current_name}' for l, r in join_cols)
@@ -0,0 +1,76 @@
1
+ import os
2
+ from typing import Dict, List, Tuple
3
+
4
+ from duckdb_kernel.db import Connection as DB, Table
5
+ from duckdb_kernel.db.error import EmptyResultError
6
+ from duckdb_kernel.parser.elements import RAElement
7
+ from duckdb_kernel.parser.elements.binary import ConditionalSet
8
+
9
+ with open('examples/tables.sql', 'r', encoding='utf-8') as file:
10
+ EXAMPLE_STMTS = [stmt
11
+ for stmt in file.read().split(';')
12
+ if stmt.strip()]
13
+
14
+
15
+ class Connection:
16
+ def __enter__(self):
17
+ db_type = os.environ.get('DB_TYPE')
18
+ if db_type == 'postgres':
19
+ host = os.environ.get('POSTGRES_HOST', 'localhost')
20
+ port = int(os.environ.get('POSTGRES_PORT', 5432))
21
+ username = os.environ.get('POSTGRES_USER', 'postgres')
22
+ password = os.environ.get('POSTGRES_PASSWORD', 'postgres')
23
+
24
+ from duckdb_kernel.db.implementation.postgres import Connection as PostgreSQL
25
+ self.con: DB = PostgreSQL(host, port, username, password, None)
26
+ elif db_type == 'sqlite':
27
+ from duckdb_kernel.db.implementation.sqlite import Connection as SQLite
28
+ self.con: DB = SQLite(':memory:')
29
+ else:
30
+ from duckdb_kernel.db.implementation.duckdb import Connection as DuckDB
31
+ self.con: DB = DuckDB(':memory:')
32
+
33
+ for stmt in EXAMPLE_STMTS:
34
+ try:
35
+ self.con.execute(stmt)
36
+ except EmptyResultError:
37
+ pass
38
+
39
+ return self
40
+
41
+ def __exit__(self, exc_type, exc_val, exc_tb):
42
+ self.con.close()
43
+
44
+ @property
45
+ def tables(self) -> Dict[str, Table]:
46
+ return self.con.analyze()
47
+
48
+ def execute_sql_return_cols(self, query: str) -> Tuple[List, List]:
49
+ return self.con.execute(query)
50
+
51
+ def execute_sql(self, query: str) -> List:
52
+ _, rows = self.execute_sql_return_cols(query)
53
+ return rows
54
+
55
+ def execute_ra_return_cols(self, root: RAElement) -> Tuple[List, List]:
56
+ sql = root.to_sql_with_renamed_columns(self.tables)
57
+ cols, rows = self.execute_sql_return_cols(sql)
58
+
59
+ return cols, sorted(rows, key=lambda t: tuple(-1 if x is None else x for x in t))
60
+
61
+ def execute_ra(self, root: RAElement) -> List:
62
+ _, rows = self.execute_ra_return_cols(root)
63
+ return rows
64
+
65
+ def execute_dc_return_cols(self, root: ConditionalSet) -> Tuple[List, List]:
66
+ sql, cnm = root.to_sql_with_renamed_columns(self.tables)
67
+ cols, rows = self.execute_sql_return_cols(sql)
68
+
69
+ return [cnm.get(c, c) for c in cols], sorted(rows)
70
+
71
+ def execute_dc(self, root: ConditionalSet) -> List:
72
+ _, rows = self.execute_dc_return_cols(root)
73
+ return rows
74
+
75
+
76
+ __all__ = ['Connection']
@@ -0,0 +1,454 @@
1
+ from duckdb_kernel.parser import DCParser
2
+ from . import Connection
3
+
4
+
5
+ def test_case_insensitivity():
6
+ for query in (
7
+ '{ username | users(id, username) }',
8
+ '{ username | Users(id, username) }',
9
+ '{ username | USERS(id, username) }',
10
+ '{ username | uSers(id, username) }',
11
+ ):
12
+ root = DCParser.parse_query(query)
13
+
14
+ # execute to test case insensitivity
15
+ with Connection() as con:
16
+ cols, rows = con.execute_dc_return_cols(root)
17
+
18
+ assert [c.lower() for c in cols] == [
19
+ 'username'
20
+ ]
21
+ assert rows == [
22
+ ('Alice',),
23
+ ('Bob',),
24
+ ('Charlie',)
25
+ ]
26
+
27
+ for query in (
28
+ '{ username | users(id, username) }',
29
+ '{ Username | users(id, username) }',
30
+ '{ USERNAME | users(id, username) }',
31
+ '{ userName | users(id, username) }',
32
+ ):
33
+ root = DCParser.parse_query(query)
34
+
35
+ # execute to test case insensitivity
36
+ with Connection() as con:
37
+ cols, rows = con.execute_dc_return_cols(root)
38
+
39
+ assert [c.lower() for c in cols] == [
40
+ 'username'
41
+ ]
42
+ assert rows == [
43
+ ('Alice',),
44
+ ('Bob',),
45
+ ('Charlie',)
46
+ ]
47
+
48
+
49
+ def test_simple_queries():
50
+ with Connection() as con:
51
+ for query in [
52
+ '{ id | Users(id, _) }',
53
+ '{ id | Users (id, _) }',
54
+ '{ id | Users id,_ }',
55
+ '{id|Users(id,_)}',
56
+ 'id | Users (id ,_)',
57
+ ]:
58
+ root = DCParser.parse_query(query)
59
+ cols, rows = con.execute_dc_return_cols(root)
60
+
61
+ assert [c.lower() for c in cols] == [
62
+ 'id'
63
+ ]
64
+ assert rows == [
65
+ (1,),
66
+ (2,),
67
+ (3,)
68
+ ]
69
+
70
+ for query in [
71
+ '{ id, name | Users(id, name) }',
72
+ '{ id,name | Users(id, name) }'
73
+ ]:
74
+ root = DCParser.parse_query(query)
75
+ cols, rows = con.execute_dc_return_cols(root)
76
+
77
+ assert [c.lower() for c in cols] == [
78
+ 'id',
79
+ 'name'
80
+ ]
81
+ assert rows == [
82
+ (1, 'Alice'),
83
+ (2, 'Bob'),
84
+ (3, 'Charlie')
85
+ ]
86
+
87
+
88
+ def test_asterisk_projection():
89
+ with Connection() as con:
90
+ root = DCParser.parse_query('{ * | Users(id, _) }')
91
+ cols, rows = con.execute_dc_return_cols(root)
92
+
93
+ assert [c.lower() for c in cols] == [
94
+ 'id'
95
+ ]
96
+ assert rows == [
97
+ (1,),
98
+ (2,),
99
+ (3,)
100
+ ]
101
+
102
+ root = DCParser.parse_query('{ * | Users(id, name) }')
103
+ cols, rows = con.execute_dc_return_cols(root)
104
+
105
+ assert [c.lower() for c in cols] == [
106
+ 'id',
107
+ 'name'
108
+ ]
109
+ assert rows == [
110
+ (1, 'Alice'),
111
+ (2, 'Bob'),
112
+ (3, 'Charlie')
113
+ ]
114
+
115
+
116
+ def test_conditions():
117
+ with Connection() as con:
118
+ for query in [
119
+ '{ name | Users(id, name) ∧ id > 1 }',
120
+ '{ name | Users(id, name) ∧ id ≠ 1 }',
121
+ '{ name | Users(id, name) ∧ (id = 2 ∨ id = 3) }'
122
+ ]:
123
+ root = DCParser.parse_query(query)
124
+ cols, rows = con.execute_dc_return_cols(root)
125
+
126
+ assert [c.lower() for c in cols] == [
127
+ 'name'
128
+ ]
129
+ assert rows == [
130
+ ('Bob',),
131
+ ('Charlie',)
132
+ ]
133
+
134
+ for query in [
135
+ '{ id | Users(id, name) ∧ name = "Bob" }',
136
+ '{ id | Users(id, name) ∧ name > "B" ∧ name < "C" }',
137
+ ]:
138
+ root = DCParser.parse_query(query)
139
+ cols, rows = con.execute_dc_return_cols(root)
140
+
141
+ assert [c.lower() for c in cols] == [
142
+ 'id'
143
+ ]
144
+ assert rows == [
145
+ (2,)
146
+ ]
147
+
148
+
149
+ def test_shortcut_conditions():
150
+ with Connection() as con:
151
+ # single shortcut conditions
152
+ for query in [
153
+ '{ name | Users(1, name) }'
154
+ ]:
155
+ root = DCParser.parse_query(query)
156
+ cols, rows = con.execute_dc_return_cols(root)
157
+
158
+ assert [c.lower() for c in cols] == [
159
+ 'name'
160
+ ]
161
+ assert rows == [
162
+ ('Alice',)
163
+ ]
164
+
165
+ for query in [
166
+ '{ season_name | Seasons(1, 1, season_name) }'
167
+ ]:
168
+ root = DCParser.parse_query(query)
169
+ cols, rows = con.execute_dc_return_cols(root)
170
+
171
+ assert [c.lower() for c in cols] == [
172
+ 'season_name'
173
+ ]
174
+ assert rows == [
175
+ ('Show 1 / Season 1',)
176
+ ]
177
+
178
+ # multiple shortcut conditions
179
+ for query in [
180
+ '{ sname, ename | Seasons(snum, 2, sname) ∧ Episodes(enum, snum, 2, ename) }'
181
+ ]:
182
+ root = DCParser.parse_query(query)
183
+ cols, rows = con.execute_dc_return_cols(root)
184
+
185
+ assert [c.lower() for c in cols] == [
186
+ 'sname',
187
+ 'ename'
188
+ ]
189
+ assert rows == [
190
+ ('Show 2 / Season 1', 'Show 2 / Season 1 / Episode 1'),
191
+ ('Show 2 / Season 1', 'Show 2 / Season 1 / Episode 2'),
192
+ ('Show 2 / Season 1', 'Show 2 / Season 1 / Episode 3'),
193
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 1'),
194
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 2'),
195
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 3'),
196
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 4')
197
+ ]
198
+
199
+
200
+ def test_joins():
201
+ with Connection() as con:
202
+ # with one attribute
203
+ for query in [
204
+ '{ sename | Shows(shid, shname) ∧ Seasons(senum, shid, sename) }'
205
+ ]:
206
+ root = DCParser.parse_query(query)
207
+ cols, rows = con.execute_dc_return_cols(root)
208
+
209
+ assert [c.lower() for c in cols] == [
210
+ 'sename'
211
+ ]
212
+ assert rows == [
213
+ ('Show 1 / Season 1',),
214
+ ('Show 1 / Season 2',),
215
+ ('Show 2 / Season 1',),
216
+ ('Show 2 / Season 2',)
217
+ ]
218
+
219
+ for query in [
220
+ '{ sename | Shows(shid, shname) ∧ Seasons(senum, shid, sename) ∧ shname = "Show 1" }',
221
+ '{ sename | Seasons(senum, shid, sename) ∧ Shows(shid, "Show 1") }'
222
+ ]:
223
+ root = DCParser.parse_query(query)
224
+ cols, rows = con.execute_dc_return_cols(root)
225
+
226
+ assert [c.lower() for c in cols] == [
227
+ 'sename'
228
+ ]
229
+ assert rows == [
230
+ ('Show 1 / Season 1',),
231
+ ('Show 1 / Season 2',)
232
+ ]
233
+
234
+ # with multiple attributes
235
+ for query in [
236
+ '{ sname, ename | Seasons(snum, shid, sname) ∧ Episodes(enum, snum, shid, ename) ∧ shid = 2 }'
237
+ ]:
238
+ root = DCParser.parse_query(query)
239
+ cols, rows = con.execute_dc_return_cols(root)
240
+
241
+ assert [c.lower() for c in cols] == [
242
+ 'sname',
243
+ 'ename'
244
+ ]
245
+ assert rows == [
246
+ ('Show 2 / Season 1', 'Show 2 / Season 1 / Episode 1'),
247
+ ('Show 2 / Season 1', 'Show 2 / Season 1 / Episode 2'),
248
+ ('Show 2 / Season 1', 'Show 2 / Season 1 / Episode 3'),
249
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 1'),
250
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 2'),
251
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 3'),
252
+ ('Show 2 / Season 2', 'Show 2 / Season 2 / Episode 4')
253
+ ]
254
+
255
+ # join three relations
256
+ for query in [
257
+ '{ s2,c5 | Shows(s1,s2) ∧ Episodes(e1,e2,s1,e4) ∧ Characters(c1,e1,c3,s1,c5) ∧ s1=2 ∧ e4="Show 2 / Season 1 / Episode 2" }'
258
+ ]:
259
+ root = DCParser.parse_query(query)
260
+ cols, rows = con.execute_dc_return_cols(root)
261
+
262
+ assert [c.lower() for c in cols] == [
263
+ 's2',
264
+ 'c5'
265
+ ]
266
+ assert rows == [
267
+ ('Show 2', 'Actor F')
268
+ ]
269
+
270
+ # cross join
271
+ root = DCParser.parse_query('{ sename | Shows(shid1, shname) ∧ Seasons(senum, shid2, sename) ∧ shid1 = shid2 }')
272
+ cols, rows = con.execute_dc_return_cols(root)
273
+
274
+ assert [c.lower() for c in cols] == [
275
+ 'sename'
276
+ ]
277
+ assert rows == [
278
+ ('Show 1 / Season 1',),
279
+ ('Show 1 / Season 2',),
280
+ ('Show 2 / Season 1',),
281
+ ('Show 2 / Season 2',)
282
+ ]
283
+
284
+ for query in [
285
+ '{ s2,c5 | Shows(sa1,s2) ∧ Episodes(e1,e2,sb1,e4) ∧ Characters(c1,e1,c3,sb1,c5) ∧ sa1=2 ∧ sa1 = sb1 ∧ e4="Show 2 / Season 1 / Episode 2" }',
286
+ '{ s2,c5 | Shows(sa1,s2) ∧ Episodes(e1,e2,sb1,e4) ∧ Characters(c1,e1,c3,sc1,c5) ∧ sa1=2 ∧ sa1 = sb1 ∧ sb1 = sc1 ∧ e4="Show 2 / Season 1 / Episode 2" }'
287
+ ]:
288
+ root = DCParser.parse_query(query)
289
+ cols, rows = con.execute_dc_return_cols(root)
290
+
291
+ assert [c.lower() for c in cols] == [
292
+ 's2',
293
+ 'c5'
294
+ ]
295
+ assert rows == [
296
+ ('Show 2', 'Actor F')
297
+ ]
298
+
299
+
300
+ def test_disjunction_joins():
301
+ with Connection() as con:
302
+ for query in [
303
+ "{ enum, snum, sid | Episodes(enum, snum, sid, ename) ∧ (Characters('Character B', enum, snum, sid, _) ∨ Characters('Character D', enum, snum, sid, _)) }",
304
+ "{ enum, snum, sid | Episodes(enum, snum, sid, ename) ∧ (Characters(cname1, enum, snum, sid, _) ∧ cname1 = 'Character B' ∨ Characters(cname2, enum, snum, sid, _) ∧ cname2 = 'Character D') }",
305
+ ]:
306
+ root = DCParser.parse_query(query)
307
+ cols, rows = con.execute_dc_return_cols(root)
308
+
309
+ assert [c.lower() for c in cols] == [
310
+ 'enum',
311
+ 'snum',
312
+ 'sid'
313
+ ]
314
+ assert rows == [
315
+ (1, 1, 1),
316
+ (2, 1, 1)
317
+ ]
318
+
319
+
320
+ def test_cross_join():
321
+ with Connection() as con:
322
+ for query in [
323
+ "{ cname1, cname2 | Characters(cname1, _, _, 2, _) ∧ Characters(cname2, _, _, 2, _) }",
324
+ ]:
325
+ root = DCParser.parse_query(query)
326
+ cols, rows = con.execute_dc_return_cols(root)
327
+
328
+ assert [c.lower() for c in cols] == [
329
+ 'cname1',
330
+ 'cname2'
331
+ ]
332
+ assert rows == [
333
+ ('Character E', 'Character E'),
334
+ ('Character E', 'Character F'),
335
+ ('Character F', 'Character E'),
336
+ ('Character F', 'Character F'),
337
+ ]
338
+
339
+
340
+ def test_underscores():
341
+ with Connection() as con:
342
+ # distinct underscores
343
+ for query in [
344
+ '{ ename | Seasons(snum, shid, sname) ∧ Episodes(_, snum, shid, ename) ∧ shid = 2 }',
345
+ '{ ename | Seasons(snum, shid, sname) ∧ Episodes(enum, _, shid, ename) ∧ shid = 2 }',
346
+ '{ ename | Seasons(snum, shid, sname) ∧ Episodes(__, snum, shid, ename) ∧ shid = 2 }',
347
+ '{ ename | Seasons(snum, shid, sname) ∧ Episodes(_, __, shid, ename) ∧ shid = 2 }'
348
+ ]:
349
+ root = DCParser.parse_query(query)
350
+ cols, rows = con.execute_dc_return_cols(root)
351
+
352
+ assert [c.lower() for c in cols] == [
353
+ 'ename'
354
+ ]
355
+ assert rows == [
356
+ ('Show 2 / Season 1 / Episode 1',),
357
+ ('Show 2 / Season 1 / Episode 2',),
358
+ ('Show 2 / Season 1 / Episode 3',),
359
+ ('Show 2 / Season 2 / Episode 1',),
360
+ ('Show 2 / Season 2 / Episode 2',),
361
+ ('Show 2 / Season 2 / Episode 3',),
362
+ ('Show 2 / Season 2 / Episode 4',)
363
+ ]
364
+
365
+ # reused underscores in a single relation
366
+ for query in [
367
+ '{ ename | Seasons(snum, shid, sname) ∧ Episodes(_, _, shid, ename) ∧ shid = 2 }'
368
+ ]:
369
+ root = DCParser.parse_query(query)
370
+ cols, rows = con.execute_dc_return_cols(root)
371
+
372
+ assert [c.lower() for c in cols] == [
373
+ 'ename'
374
+ ]
375
+ assert rows == [
376
+ ('Show 2 / Season 1 / Episode 1',),
377
+ ('Show 2 / Season 1 / Episode 2',),
378
+ ('Show 2 / Season 1 / Episode 3',),
379
+ ('Show 2 / Season 2 / Episode 1',),
380
+ ('Show 2 / Season 2 / Episode 2',),
381
+ ('Show 2 / Season 2 / Episode 3',),
382
+ ('Show 2 / Season 2 / Episode 4',)
383
+ ]
384
+
385
+ # reused underscores in two different relations
386
+ for query in [
387
+ '{ ename | Seasons(_, shid, _) ∧ Episodes(_, _, shid, ename) ∧ shid = 2 }',
388
+ '{ ename | Seasons(_, shid, __) ∧ Episodes(_, __, shid, ename) ∧ shid = 2 }'
389
+ ]:
390
+ root = DCParser.parse_query(query)
391
+ cols, rows = con.execute_dc_return_cols(root)
392
+
393
+ assert [c.lower() for c in cols] == [
394
+ 'ename'
395
+ ]
396
+ assert rows == [
397
+ ('Show 2 / Season 1 / Episode 1',),
398
+ ('Show 2 / Season 1 / Episode 2',),
399
+ ('Show 2 / Season 1 / Episode 3',),
400
+ ('Show 2 / Season 2 / Episode 1',),
401
+ ('Show 2 / Season 2 / Episode 2',),
402
+ ('Show 2 / Season 2 / Episode 3',),
403
+ ('Show 2 / Season 2 / Episode 4',)
404
+ ]
405
+
406
+ def test_anonymous_column_names():
407
+ with Connection() as con:
408
+ for query in [
409
+ '{ * | Episodes(_, _, 2, ename) }',
410
+ ]:
411
+ root = DCParser.parse_query(query)
412
+ cols, _ = con.execute_dc_return_cols(root)
413
+
414
+ assert cols == ['2', 'ename']
415
+
416
+ for query in [
417
+ "{ * | Episodes(_, _, '2', ename) }",
418
+ ]:
419
+ root = DCParser.parse_query(query)
420
+ cols, _ = con.execute_dc_return_cols(root)
421
+
422
+ assert cols == ["'2'", 'ename']
423
+
424
+ for query in [
425
+ "{ * | Episodes(_, _, sid, 'ename') }",
426
+ ]:
427
+ root = DCParser.parse_query(query)
428
+ cols, _ = con.execute_dc_return_cols(root)
429
+
430
+ assert cols == ['sid', "'ename'"]
431
+
432
+ for query in [
433
+ '{ * | Episodes(_, 1, 2, ename) }',
434
+ ]:
435
+ root = DCParser.parse_query(query)
436
+ cols, _ = con.execute_dc_return_cols(root)
437
+
438
+ assert cols == ['1', '2', 'ename']
439
+
440
+ for query in [
441
+ '{ * | Episodes(_, 2, 2, ename) }',
442
+ ]:
443
+ root = DCParser.parse_query(query)
444
+ cols, _ = con.execute_dc_return_cols(root)
445
+
446
+ assert cols == ['2', '2', 'ename']
447
+
448
+ for query in [
449
+ '{ * | Episodes(_, _, sid, ename) ∧ sid = 2 }',
450
+ ]:
451
+ root = DCParser.parse_query(query)
452
+ cols, _ = con.execute_dc_return_cols(root)
453
+
454
+ assert cols == ['sid', 'ename']