Skip to content

Commit ec58144

Browse files
bkyryliukJesse Whitehouse
andauthored
Disable non_native_boolean_check_constraint (#120)
--------- Signed-off-by: Bogdan Kyryliuk <[email protected]> Signed-off-by: Jesse Whitehouse <[email protected]> Co-authored-by: Jesse Whitehouse <[email protected]>
1 parent 1eef432 commit ec58144

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add support for Cloud Fetch (#146, #151, #154)
66
- SQLAlchemy has_table function now honours schema= argument and adds catalog= argument (#174)
7+
- SQLAlchemy set non_native_boolean_check_constraint False as it's not supported by Databricks (#120)
78
- Fix: Revised SQLAlchemy dialect and examples for compatibility with SQLAlchemy==1.3.x (#173)
89
- Fix: oauth would fail if expired credentials appeared in ~/.netrc (#122)
910
- Fix: Python HTTP proxies were broken after switch to urllib3 (#158)

examples/sqlalchemy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class SampleObject(base):
8989

9090
name = Column(String(255), primary_key=True)
9191
episodes = Column(Integer)
92-
some_bool = Column(BOOLEAN(create_constraint=False))
92+
some_bool = Column(BOOLEAN)
9393

9494

9595
base.metadata.create_all()

src/databricks/sqlalchemy/dialect/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class DatabricksDialect(default.DefaultDialect):
8181
supports_multivalues_insert: bool = True
8282
supports_native_decimal: bool = True
8383
supports_sane_rowcount: bool = False
84+
non_native_boolean_check_constraint: bool = False
8485

8586
@classmethod
8687
def dbapi(cls):

tests/e2e/sqlalchemy/test_basic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_create_table_not_null(db_engine, metadata_obj: MetaData):
148148
metadata_obj,
149149
Column("name", String(255)),
150150
Column("episodes", Integer),
151-
Column("some_bool", BOOLEAN(create_constraint=False), nullable=False),
151+
Column("some_bool", BOOLEAN, nullable=False),
152152
)
153153

154154
metadata_obj.create_all()
@@ -201,7 +201,7 @@ def test_create_insert_drop_table_core(base, db_engine, metadata_obj: MetaData):
201201
metadata_obj,
202202
Column("name", String(255)),
203203
Column("episodes", Integer),
204-
Column("some_bool", BOOLEAN(create_constraint=False)),
204+
Column("some_bool", BOOLEAN),
205205
Column("dollars", DECIMAL(10, 2)),
206206
)
207207

@@ -240,7 +240,7 @@ class SampleObject(base):
240240

241241
name = Column(String(255), primary_key=True)
242242
episodes = Column(Integer)
243-
some_bool = Column(BOOLEAN(create_constraint=False))
243+
some_bool = Column(BOOLEAN)
244244

245245
base.metadata.create_all()
246246

@@ -272,7 +272,7 @@ def test_dialect_type_mappings(base, db_engine, metadata_obj: MetaData):
272272
metadata_obj,
273273
Column("string_example", String(255)),
274274
Column("integer_example", Integer),
275-
Column("boolean_example", BOOLEAN(create_constraint=False)),
275+
Column("boolean_example", BOOLEAN),
276276
Column("decimal_example", DECIMAL(10, 2)),
277277
Column("date_example", Date),
278278
)

0 commit comments

Comments
 (0)