Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 2, 2024
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: 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'
)