Skip to content

Commit c673331

Browse files
committed
Propagate error traces properly, using the error_trace connect_args
... option, by using `crate-1.0.0dev1`
1 parent 314d430 commit c673331

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Changelog
22

33
## Unreleased
4+
- Propagate error traces properly, using the `error_trace` `connect_args` option,
5+
by using `crate-1.0.0dev1`
46

57
## 2024/08/29 0.39.0
6-
Added `quote_relation_name` support utility function
8+
- Added `quote_relation_name` support utility function
79

810
## 2024/06/25 0.38.0
911
- Added/reactivated documentation as `sqlalchemy-cratedb`

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ dynamic = [
8181
]
8282
dependencies = [
8383
"backports.zoneinfo<1; python_version<'3.9'",
84-
"crate==1.0.0.dev0",
84+
"crate==1.0.0.dev1",
8585
"geojson<4,>=2.5",
8686
"importlib-resources; python_version<'3.9'",
8787
"sqlalchemy<2.1,>=1",

tests/test_error_handling.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import re
2+
3+
import pytest
4+
import sqlalchemy as sa
5+
6+
7+
def test_statement_with_error_trace(cratedb_service):
8+
"""
9+
Verify that the `error_trace` option works correctly.
10+
"""
11+
engine = sa.create_engine(cratedb_service.database.dburi, connect_args={"error_trace": True})
12+
with engine.connect() as connection:
13+
with pytest.raises(sa.exc.ProgrammingError) as ex:
14+
connection.execute(sa.text("CREATE TABLE foo AS SELECT 1 AS _foo"))
15+
assert ex.match(
16+
re.escape('InvalidColumnNameException["_foo" conflicts with system column pattern]')
17+
)
18+
assert ex.match(
19+
"io.crate.exceptions.InvalidColumnNameException: "
20+
'"_foo" conflicts with system column pattern'
21+
)

0 commit comments

Comments
 (0)