Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/firebolt/async_db/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
DataError,
EngineNotRunningError,
FireboltDatabaseError,
NotSupportedError,
OperationalError,
ProgrammingError,
QueryNotRunError,
Expand Down Expand Up @@ -218,6 +219,9 @@ async def _do_execute_request(
parameters: Optional[Sequence[ParameterType]] = None,
set_parameters: Optional[Dict] = None,
) -> Response:
if parameters:
raise NotSupportedError("parametrized queries are not supported")

resp = await self._client.request(
url="/",
method="POST",
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/async_db/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
DataError,
EngineNotRunningError,
FireboltDatabaseError,
NotSupportedError,
OperationalError,
QueryNotRunError,
)
Expand Down Expand Up @@ -406,3 +407,13 @@ async def test_set_parameters(
httpx_mock.add_callback(auth_callback, url=auth_url)
httpx_mock.add_callback(query_with_params_callback, url=query_with_params_url)
await cursor.execute("select 1", set_parameters=set_params)


@mark.asyncio
async def test_cursor_execute_parameters(cursor: Cursor):
"""execute and executemany with parameters are not supported"""
with raises(NotSupportedError):
await cursor.execute("select ?", (1,))

with raises(NotSupportedError):
await cursor.executemany("select ?", [(1,), (2,)])
10 changes: 10 additions & 0 deletions tests/unit/db/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from firebolt.common.exception import (
CursorClosedError,
DataError,
NotSupportedError,
OperationalError,
QueryNotRunError,
)
Expand Down Expand Up @@ -354,3 +355,12 @@ def test_set_parameters(
httpx_mock.add_callback(auth_callback, url=auth_url)
httpx_mock.add_callback(query_with_params_callback, url=query_with_params_url)
cursor.execute("select 1", set_parameters=set_params)


def test_cursor_execute_parameters(cursor: Cursor):
"""execute and executemany with parameters are not supported"""
with raises(NotSupportedError):
cursor.execute("select ?", (1,))

with raises(NotSupportedError):
cursor.executemany("select ?", [(1,), (2,)])