-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exception when retrieving mixed data types (#111)
If the first row of a column returned from Exasol was a decimal type then the adapter would expect all subsequent rows to be decimal and if one of them happened to be NULL it would throw an exception: "conversion from NoneType to Decimal is not supported" This commit fixes that. Co-authored-by: Peter Kioko <kioko@grantstreet.com>
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
tests/functional/adapter/utils/test_mixed_type_retrieval.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import pytest | ||
import decimal | ||
from dbt.tests.util import get_connection | ||
|
||
class TestMixedTypeRetrieval: | ||
# A Decimal followed by a NULL used to raise an exception. | ||
# Verify that it no longer does. | ||
def test_decimal_followed_by_null(self,project): | ||
sql = "select * from values 1.2, null" | ||
with get_connection(project.adapter) as conn: | ||
_, res = project.adapter.execute(sql, fetch=True) | ||
assert res.rows.values() == ( ( decimal.Decimal('1.2'), ),( None, ) ) |