jupyter-duckdb 1.2.0.5__tar.gz → 1.2.0.6__tar.gz

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.
Files changed (95) hide show
  1. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/PKG-INFO +1 -1
  2. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/duckdb/Connection.py +5 -1
  3. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/sqlite/Connection.py +2 -1
  4. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/kernel.py +20 -5
  5. jupyter_duckdb-1.2.0.6/src/duckdb_kernel/util/SQL.py +6 -0
  6. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/jupyter_duckdb.egg-info/PKG-INFO +1 -1
  7. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/jupyter_duckdb.egg-info/SOURCES.txt +3 -1
  8. jupyter_duckdb-1.2.0.6/test/test_sql.py +48 -0
  9. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/README.md +0 -0
  10. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/setup.cfg +0 -0
  11. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/setup.py +0 -0
  12. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/__init__.py +0 -0
  13. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/__main__.py +0 -0
  14. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/Column.py +0 -0
  15. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/Connection.py +0 -0
  16. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/Constraint.py +0 -0
  17. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/DatabaseError.py +0 -0
  18. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/ForeignKey.py +0 -0
  19. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/Table.py +0 -0
  20. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/__init__.py +0 -0
  21. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/error/EmptyResultError.py +0 -0
  22. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/error/__init__.py +0 -0
  23. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/duckdb/__init__.py +0 -0
  24. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/postgres/Connection.py +0 -0
  25. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/postgres/__init__.py +0 -0
  26. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/postgres/util.py +0 -0
  27. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/db/implementation/sqlite/__init__.py +0 -0
  28. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/kernel.json +0 -0
  29. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/magics/MagicCommand.py +0 -0
  30. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/magics/MagicCommandCallback.py +0 -0
  31. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/magics/MagicCommandException.py +0 -0
  32. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/magics/MagicCommandHandler.py +0 -0
  33. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/magics/StringWrapper.py +0 -0
  34. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/magics/__init__.py +0 -0
  35. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/DCParser.py +0 -0
  36. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/LogicParser.py +0 -0
  37. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/ParserError.py +0 -0
  38. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/RAParser.py +0 -0
  39. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/__init__.py +0 -0
  40. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/DCOperand.py +0 -0
  41. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/LogicElement.py +0 -0
  42. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/LogicOperand.py +0 -0
  43. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/LogicOperator.py +0 -0
  44. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/RABinaryOperator.py +0 -0
  45. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/RAElement.py +0 -0
  46. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/RAOperand.py +0 -0
  47. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/RAOperator.py +0 -0
  48. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/RAUnaryOperator.py +0 -0
  49. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/__init__.py +0 -0
  50. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Add.py +0 -0
  51. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/And.py +0 -0
  52. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/ArrowLeft.py +0 -0
  53. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/ConditionalSet.py +0 -0
  54. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Cross.py +0 -0
  55. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Difference.py +0 -0
  56. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Divide.py +0 -0
  57. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Division.py +0 -0
  58. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Equal.py +0 -0
  59. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/GreaterThan.py +0 -0
  60. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/GreaterThanEqual.py +0 -0
  61. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Intersection.py +0 -0
  62. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Join.py +0 -0
  63. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/LessThan.py +0 -0
  64. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/LessThanEqual.py +0 -0
  65. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Minus.py +0 -0
  66. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Multiply.py +0 -0
  67. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Or.py +0 -0
  68. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Unequal.py +0 -0
  69. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/Union.py +0 -0
  70. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/binary/__init__.py +0 -0
  71. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/unary/Not.py +0 -0
  72. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/unary/Projection.py +0 -0
  73. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/unary/Rename.py +0 -0
  74. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/unary/Selection.py +0 -0
  75. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/elements/unary/__init__.py +0 -0
  76. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/tokenizer/Token.py +0 -0
  77. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/tokenizer/Tokenizer.py +0 -0
  78. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/tokenizer/__init__.py +0 -0
  79. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/util/RenamableColumn.py +0 -0
  80. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/util/RenamableColumnList.py +0 -0
  81. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/parser/util/__init__.py +0 -0
  82. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/util/ResultSetComparator.py +0 -0
  83. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/util/TestError.py +0 -0
  84. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/util/__init__.py +0 -0
  85. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/util/formatting.py +0 -0
  86. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/visualization/Drawer.py +0 -0
  87. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/visualization/RATreeDrawer.py +0 -0
  88. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/visualization/SchemaDrawer.py +0 -0
  89. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/duckdb_kernel/visualization/__init__.py +0 -0
  90. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/jupyter_duckdb.egg-info/dependency_links.txt +0 -0
  91. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/jupyter_duckdb.egg-info/requires.txt +0 -0
  92. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/src/jupyter_duckdb.egg-info/top_level.txt +0 -0
  93. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/test/test_dc.py +0 -0
  94. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/test/test_ra.py +0 -0
  95. {jupyter_duckdb-1.2.0.5 → jupyter_duckdb-1.2.0.6}/test/test_result_comparison.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jupyter-duckdb
3
- Version: 1.2.0.5
3
+ Version: 1.2.0.6
4
4
  Summary: a basic wrapper kernel for DuckDB
5
5
  Home-page: https://github.com/erictroebs/jupyter-duckdb
6
6
  Author: Eric Tröbs
@@ -4,6 +4,7 @@ import duckdb
4
4
 
5
5
  from ... import DatabaseError, Column, Constraint, ForeignKey, Table
6
6
  from ...Connection import Connection as Base
7
+ from ...error import EmptyResultError
7
8
 
8
9
 
9
10
  class Connection(Base):
@@ -36,7 +37,10 @@ class Connection(Base):
36
37
  raise e
37
38
 
38
39
  # get rows
39
- rows = cursor.fetchall()
40
+ try:
41
+ rows = cursor.fetchall()
42
+ except duckdb.InvalidInputException as e:
43
+ raise EmptyResultError(str(e))
40
44
 
41
45
  # get columns
42
46
  if cursor.description is None:
@@ -4,6 +4,7 @@ from typing import Dict, List, Tuple, Any
4
4
 
5
5
  from ... import DatabaseError, Column, Constraint, ForeignKey, Table
6
6
  from ...Connection import Connection as Base
7
+ from ...error import EmptyResultError
7
8
 
8
9
 
9
10
  class Connection(Base):
@@ -41,7 +42,7 @@ class Connection(Base):
41
42
 
42
43
  # get columns
43
44
  if cursor.description is None:
44
- columns = []
45
+ raise EmptyResultError()
45
46
  else:
46
47
  columns = [e[0] for e in cursor.description]
47
48
 
@@ -14,6 +14,7 @@ from .db.error import *
14
14
  from .magics import *
15
15
  from .parser import RAParser, DCParser, ParserError
16
16
  from .util.ResultSetComparator import ResultSetComparator
17
+ from .util.SQL import SQL_KEYWORDS
17
18
  from .util.TestError import TestError
18
19
  from .util.formatting import row_count, rows_table, wrap_image
19
20
  from .visualization import *
@@ -46,11 +47,12 @@ class DuckDBKernel(Kernel):
46
47
  MagicCommand('query_max_rows').arg('count').on(self._query_max_rows_magic),
47
48
  MagicCommand('schema').flag('td').opt('only').on(self._schema_magic),
48
49
  MagicCommand('store').arg('file').flag('noheader').result(True).on(self._store_magic),
49
- MagicCommand('ra').disable('dc', 'auto_parser').flag('analyze').code(True).on(self._ra_magic),
50
+ MagicCommand('sql').disable('ra', 'dc', 'auto_parser'),
51
+ MagicCommand('ra').disable('sql', 'dc', 'auto_parser').flag('analyze').code(True).on(self._ra_magic),
50
52
  MagicCommand('all_ra').arg('value', '1').on(self._all_ra_magic),
51
- MagicCommand('dc').disable('ra', 'auto_parser').code(True).on(self._dc_magic),
53
+ MagicCommand('dc').disable('sql', 'ra', 'auto_parser').code(True).on(self._dc_magic),
52
54
  MagicCommand('all_dc').arg('value', '1').on(self._all_dc_magic),
53
- MagicCommand('auto_parser').disable('ra', 'dc').code(True).on(self._auto_parser_magic),
55
+ MagicCommand('auto_parser').disable('sql', 'ra', 'dc').code(True).on(self._auto_parser_magic),
54
56
  MagicCommand('guess_parser').arg('value', '1').on(self._guess_parser_magic),
55
57
  )
56
58
 
@@ -301,6 +303,11 @@ class DuckDBKernel(Kernel):
301
303
  self.print(f'loaded tests from {with_tests}\n')
302
304
 
303
305
  def _test_magic(self, silent: bool, result_columns: List[str], result: List[List], name: str):
306
+ # If the query was empty, result_columns and result may be None.
307
+ if result_columns is None or result is None:
308
+ self.print_data(wrap_image(False, 'Statement did not return data.'))
309
+ return
310
+
304
311
  # Testing makes no sense if there is no output.
305
312
  if silent:
306
313
  return
@@ -550,14 +557,22 @@ class DuckDBKernel(Kernel):
550
557
  self._magics['auto_parser'].default(False)
551
558
 
552
559
  def _auto_parser_magic(self, silent: bool, code: str):
560
+ # do not handle statements starting with SQL keywords
561
+ first_word = code.strip().split(maxsplit=1)
562
+ if len(first_word) > 0:
563
+ if first_word[0].upper() in SQL_KEYWORDS:
564
+ return
565
+
566
+ # try to parse DC
553
567
  try:
554
- return self._ra_magic(silent, code, analyze=False)
568
+ return self._dc_magic(silent, code)
555
569
  except ParserError as e:
556
570
  if e.depth > 0:
557
571
  raise e
558
572
 
573
+ # try to parse RA
559
574
  try:
560
- return self._dc_magic(silent, code)
575
+ return self._ra_magic(silent, code, analyze=False)
561
576
  except ParserError as e:
562
577
  if e.depth > 0:
563
578
  raise e
@@ -0,0 +1,6 @@
1
+ # see https://www.postgresql.org/docs/current/sql-commands.html
2
+ SQL_KEYWORDS = ('ABORT', 'ALTER', 'ANALYZE', 'BEGIN', 'CALL', 'CHECKPOINT', 'CLOSE', 'CLUSTER', 'COMMENT', 'COMMIT',
3
+ 'COPY', 'CREATE', 'DEALLOCATE', 'DECLARE', 'DELETE', 'DISCARD', 'DO', 'DROP', 'END', 'EXECUTE',
4
+ 'EXPLAIN', 'FETCH', 'GRANT', 'IMPORT', 'INSERT', 'LISTEN', 'LOAD', 'LOCK', 'MERGE', 'MOVE', 'NOTIFY',
5
+ 'PREPARE', 'REASSIGN', 'REFRESH', 'REINDEX', 'RELEASE', 'RESET', 'REVOKE', 'ROLLBACK', 'SAVEPOINT',
6
+ 'SECURITY', 'SELECT', 'SET', 'SHOW', 'START', 'TRUNCATE', 'UNLISTEN', 'UPDATE', 'VACUUM', 'VALUES')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: jupyter-duckdb
3
- Version: 1.2.0.5
3
+ Version: 1.2.0.6
4
4
  Summary: a basic wrapper kernel for DuckDB
5
5
  Home-page: https://github.com/erictroebs/jupyter-duckdb
6
6
  Author: Eric Tröbs
@@ -74,6 +74,7 @@ src/duckdb_kernel/parser/util/RenamableColumn.py
74
74
  src/duckdb_kernel/parser/util/RenamableColumnList.py
75
75
  src/duckdb_kernel/parser/util/__init__.py
76
76
  src/duckdb_kernel/util/ResultSetComparator.py
77
+ src/duckdb_kernel/util/SQL.py
77
78
  src/duckdb_kernel/util/TestError.py
78
79
  src/duckdb_kernel/util/__init__.py
79
80
  src/duckdb_kernel/util/formatting.py
@@ -88,4 +89,5 @@ src/jupyter_duckdb.egg-info/requires.txt
88
89
  src/jupyter_duckdb.egg-info/top_level.txt
89
90
  test/test_dc.py
90
91
  test/test_ra.py
91
- test/test_result_comparison.py
92
+ test/test_result_comparison.py
93
+ test/test_sql.py
@@ -0,0 +1,48 @@
1
+ import pytest
2
+
3
+ from duckdb_kernel.db.error import EmptyResultError
4
+ from . import Connection
5
+
6
+
7
+ def test_simple_queries():
8
+ query = 'SELECT Username FROM Users'
9
+
10
+ with Connection() as con:
11
+ assert con.execute_sql(query) == [
12
+ ('Alice',),
13
+ ('Bob',),
14
+ ('Charlie',)
15
+ ]
16
+
17
+
18
+ def test_empty_result():
19
+ with Connection() as con:
20
+ query = "SELECT Username FROM Users WHERE Username = 'abcdef'"
21
+ assert con.execute_sql(query) == []
22
+
23
+ with Connection() as con:
24
+ query = 'CREATE TABLE foo (bar INTEGER PRIMARY KEY)'
25
+ try:
26
+ assert con.execute_sql(query) == []
27
+ except EmptyResultError:
28
+ pass
29
+
30
+
31
+ def test_empty_queries():
32
+ for query in [
33
+ '',
34
+ ' ',
35
+ '\n',
36
+ '-- this is an empty query too'
37
+ ]:
38
+ with pytest.raises(EmptyResultError):
39
+ with Connection() as con:
40
+ con.execute_sql(query)
41
+
42
+ with pytest.raises(Exception):
43
+ with Connection() as con:
44
+ query = '-- this is a query with syntax errors\nFOR foo IN bar'
45
+ try:
46
+ con.execute_sql(query)
47
+ except EmptyResultError:
48
+ pass