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

Commitb35f0c9

Browse files
author
Jesse Whitehouse
committed
First implementation that passes the integration test.
There seems to be two mechanisms where I can hook into the type compilerIn this one, I explicitly set a dialect-specific compilation overwrite.Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
1 parent96774b1 commitb35f0c9

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎src/databricks/sqlalchemy/dialect/__init__.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ class TINYINT(types.Integer):
7474
Details about this type: https://docs.databricks.com/sql/language-manual/data-types/tinyint-type.html
7575
"""
7676
__visit_name__="TINYINT"
77+
78+
fromsqlalchemy.ext.compilerimportcompiles
79+
@compiles(TINYINT,"databricks")
80+
defcompile_tinyint_databricks(type_,compiler,**kw):
81+
return"TINYINT"
82+
7783
classDatabricksDialect(default.DefaultDialect):
7884
"""This dialect implements only those methods required to pass our e2e tests"""
7985

‎tests/e2e/sqlalchemy/test_basic.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
fromsqlalchemyimportcreate_engine,select,insert,Column,MetaData,Table
55
fromsqlalchemy.ormimportdeclarative_base,Session
66
fromsqlalchemy.typesimportSMALLINT,Integer,BOOLEAN,String,DECIMAL,Date
7+
fromdatabricks.sqlalchemy.dialectimportTINYINT
78

89

910
USER_AGENT_TOKEN="PySQL e2e Tests"
@@ -150,6 +151,7 @@ def test_create_insert_drop_table_core(base, db_engine, metadata_obj: MetaData):
150151
Column("episodes",Integer),
151152
Column("some_bool",BOOLEAN),
152153
Column("dollars",DECIMAL(10,2)),
154+
Column("tiny_int",TINYINT)
153155
)
154156

155157
metadata_obj.create_all()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp