Skip to content

Commit

Permalink
Propagate error traces properly, using the error_trace connect_args
Browse files Browse the repository at this point in the history
... option, by using `crate-1.0.0dev1`
  • Loading branch information
amotl committed Oct 2, 2024
1 parent 314d430 commit c673331
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Changelog

## Unreleased
- Propagate error traces properly, using the `error_trace` `connect_args` option,
by using `crate-1.0.0dev1`

## 2024/08/29 0.39.0
Added `quote_relation_name` support utility function
- Added `quote_relation_name` support utility function

## 2024/06/25 0.38.0
- Added/reactivated documentation as `sqlalchemy-cratedb`
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ dynamic = [
]
dependencies = [
"backports.zoneinfo<1; python_version<'3.9'",
"crate==1.0.0.dev0",
"crate==1.0.0.dev1",
"geojson<4,>=2.5",
"importlib-resources; python_version<'3.9'",
"sqlalchemy<2.1,>=1",
Expand Down
21 changes: 21 additions & 0 deletions tests/test_error_handling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import re

import pytest
import sqlalchemy as sa


def test_statement_with_error_trace(cratedb_service):
"""
Verify that the `error_trace` option works correctly.
"""
engine = sa.create_engine(cratedb_service.database.dburi, connect_args={"error_trace": True})
with engine.connect() as connection:
with pytest.raises(sa.exc.ProgrammingError) as ex:
connection.execute(sa.text("CREATE TABLE foo AS SELECT 1 AS _foo"))
assert ex.match(
re.escape('InvalidColumnNameException["_foo" conflicts with system column pattern]')
)
assert ex.match(
"io.crate.exceptions.InvalidColumnNameException: "
'"_foo" conflicts with system column pattern'
)

0 comments on commit c673331

Please sign in to comment.