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

Added support for tinyint to _parse.py#315

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
susodapop merged 5 commits intodatabricks:mainfromTimTheinAtTabs:patch-1
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
3 changes: 2 additions & 1 deletionCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,8 @@

# 3.1.0 (TBD)

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

Expand Down
1 change: 1 addition & 0 deletionssrc/databricks/sqlalchemy/_parse.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -305,6 +305,7 @@ def get_comment_from_dte_output(dte_output: List[Dict[str, str]]) -> Optional[st
GET_COLUMNS_TYPE_MAP = {
"boolean": sqlalchemy.types.Boolean,
"smallint": sqlalchemy.types.SmallInteger,
"tinyint": type_overrides.TINYINT,
"int": sqlalchemy.types.Integer,
"bigint": sqlalchemy.types.BigInteger,
"float": sqlalchemy.types.Float,
Expand Down
4 changes: 4 additions & 0 deletionssrc/databricks/sqlalchemy/_types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -316,3 +316,7 @@ class TINYINT(sqlalchemy.types.TypeDecorator):

impl = sqlalchemy.types.SmallInteger
cache_ok = True

@compiles(TINYINT, "databricks")
def compile_tinyint(type_, compiler, **kw):
return "TINYINT"
9 changes: 5 additions & 4 deletionssrc/databricks/sqlalchemy/test_local/test_types.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -111,7 +111,7 @@ def test_numeric_renders_as_decimal_with_precision(self):
)

def test_numeric_renders_as_decimal_with_precision_and_scale(self):
returnself._assert_compiled_value_explicit(
self._assert_compiled_value_explicit(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I found during testing that this test case would always pass because prefixing an assertion withreturn always evaluates as a pass. When I removed thereturn, the test failed for TINYINT types (should have been caught during initial development). This test now passes.

sqlalchemy.types.Numeric(10, 2), "DECIMAL(10, 2)"
)

Expand DownExpand Up@@ -146,15 +146,16 @@ def test_bare_uppercase_types_compile(self, type_, expected):
if isinstance(type_, type(sqlalchemy.types.ARRAY)):
# ARRAY cannot be initialised without passing an item definition so we test separately
# I preserve it in the uppercase_type_map for clarity
return True
return self._assert_compiled_value(type_, expected)
assert True
else:
self._assert_compiled_value(type_, expected)

def test_array_string_renders_as_array_of_string(self):
"""SQLAlchemy's ARRAY type requires an item definition. And their docs indicate that they've only tested
it with Postgres since that's the only first-class dialect with support for ARRAY.

https://docs.sqlalchemy.org/en/20/core/type_basics.html#sqlalchemy.types.ARRAY
"""
returnself._assert_compiled_value_explicit(
self._assert_compiled_value_explicit(
sqlalchemy.types.ARRAY(sqlalchemy.types.String), "ARRAY<STRING>"
)

[8]ページ先頭

©2009-2025 Movatter.jp