Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc71e081

Browse files
SQLAlchemy: TINYINT types didn't reflect properly (#315)
Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
1 parent4bb3c9e commitc71e081

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

‎CHANGELOG.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
#3.1.0 (TBD)
44

5-
- SQLAlchemy: Added support for table and column comments (thanks@cbornet!)
5+
- SQLAlchemy dialect now supports table and column comments (thanks@cbornet!)
6+
- Fix: SQLAlchemy dialect now correctly reflects TINYINT types (thanks@TimTheinAtTabs!)
67
- Fix:`server_hostname` URIs that included`https://` would raise an exception
78
- Other: pinned to`pandas<=2.1` and`urllib3>=1.26` to avoid runtime errors in dbt-databricks (#330)
89

‎src/databricks/sqlalchemy/_parse.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ def get_comment_from_dte_output(dte_output: List[Dict[str, str]]) -> Optional[st
305305
GET_COLUMNS_TYPE_MAP= {
306306
"boolean":sqlalchemy.types.Boolean,
307307
"smallint":sqlalchemy.types.SmallInteger,
308+
"tinyint":type_overrides.TINYINT,
308309
"int":sqlalchemy.types.Integer,
309310
"bigint":sqlalchemy.types.BigInteger,
310311
"float":sqlalchemy.types.Float,

‎src/databricks/sqlalchemy/_types.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,7 @@ class TINYINT(sqlalchemy.types.TypeDecorator):
316316

317317
impl=sqlalchemy.types.SmallInteger
318318
cache_ok=True
319+
320+
@compiles(TINYINT,"databricks")
321+
defcompile_tinyint(type_,compiler,**kw):
322+
return"TINYINT"

‎src/databricks/sqlalchemy/test_local/test_types.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_numeric_renders_as_decimal_with_precision(self):
111111
)
112112

113113
deftest_numeric_renders_as_decimal_with_precision_and_scale(self):
114-
returnself._assert_compiled_value_explicit(
114+
self._assert_compiled_value_explicit(
115115
sqlalchemy.types.Numeric(10,2),"DECIMAL(10, 2)"
116116
)
117117

@@ -146,15 +146,16 @@ def test_bare_uppercase_types_compile(self, type_, expected):
146146
ifisinstance(type_,type(sqlalchemy.types.ARRAY)):
147147
# ARRAY cannot be initialised without passing an item definition so we test separately
148148
# I preserve it in the uppercase_type_map for clarity
149-
returnTrue
150-
returnself._assert_compiled_value(type_,expected)
149+
assertTrue
150+
else:
151+
self._assert_compiled_value(type_,expected)
151152

152153
deftest_array_string_renders_as_array_of_string(self):
153154
"""SQLAlchemy's ARRAY type requires an item definition. And their docs indicate that they've only tested
154155
it with Postgres since that's the only first-class dialect with support for ARRAY.
155156
156157
https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqlalchemy.types.ARRAY
157158
"""
158-
returnself._assert_compiled_value_explicit(
159+
self._assert_compiled_value_explicit(
159160
sqlalchemy.types.ARRAY(sqlalchemy.types.String),"ARRAY<STRING>"
160161
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp