From 0672be399d29e9e46da80b01c118143128688b67 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 9 May 2023 06:46:04 -0700 Subject: [PATCH 1/3] Disable non_native_boolean_check_constraint signed-off-by: Bogdan Kyryliuk --- src/databricks/sqlalchemy/dialect/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/databricks/sqlalchemy/dialect/__init__.py b/src/databricks/sqlalchemy/dialect/__init__.py index da508bb09..77bd28208 100644 --- a/src/databricks/sqlalchemy/dialect/__init__.py +++ b/src/databricks/sqlalchemy/dialect/__init__.py @@ -80,6 +80,7 @@ class DatabricksDialect(default.DefaultDialect): supports_multivalues_insert: bool = True supports_native_decimal: bool = True supports_sane_rowcount: bool = False + non_native_boolean_check_constraint: bool = False @classmethod def dbapi(cls): From 4fb67162b56661021f184448321826e02280487c Mon Sep 17 00:00:00 2001 From: Jesse Whitehouse Date: Wed, 12 Jul 2023 16:10:59 -0500 Subject: [PATCH 2/3] Update changelog Signed-off-by: Jesse Whitehouse --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53236afcf..991a24cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Add support for Cloud Fetch (#146, #151, #154) - SQLAlchemy has_table function now honours schema= argument and adds catalog= argument (#174) +- SQLAlchemy set non_native_boolean_check_constraint False as it's not supported by Databricks (#120) - Fix: Revised SQLAlchemy dialect and examples for compatibility with SQLAlchemy==1.3.x (#173) - Fix: oauth would fail if expired credentials appeared in ~/.netrc (#122) - Fix: Python HTTP proxies were broken after switch to urllib3 (#158) From 4c3ed8e38be26375d11c8edc748ee41a21588c88 Mon Sep 17 00:00:00 2001 From: Jesse Whitehouse Date: Wed, 12 Jul 2023 16:35:11 -0500 Subject: [PATCH 3/3] Update test suite and example script to remove superfluous settings Signed-off-by: Jesse Whitehouse --- examples/sqlalchemy.py | 2 +- tests/e2e/sqlalchemy/test_basic.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/sqlalchemy.py b/examples/sqlalchemy.py index 351606582..efb8f0bf5 100644 --- a/examples/sqlalchemy.py +++ b/examples/sqlalchemy.py @@ -89,7 +89,7 @@ class SampleObject(base): name = Column(String(255), primary_key=True) episodes = Column(Integer) - some_bool = Column(BOOLEAN(create_constraint=False)) + some_bool = Column(BOOLEAN) base.metadata.create_all() diff --git a/tests/e2e/sqlalchemy/test_basic.py b/tests/e2e/sqlalchemy/test_basic.py index 1d3125f2b..f17828eb1 100644 --- a/tests/e2e/sqlalchemy/test_basic.py +++ b/tests/e2e/sqlalchemy/test_basic.py @@ -148,7 +148,7 @@ def test_create_table_not_null(db_engine, metadata_obj: MetaData): metadata_obj, Column("name", String(255)), Column("episodes", Integer), - Column("some_bool", BOOLEAN(create_constraint=False), nullable=False), + Column("some_bool", BOOLEAN, nullable=False), ) metadata_obj.create_all() @@ -201,7 +201,7 @@ def test_create_insert_drop_table_core(base, db_engine, metadata_obj: MetaData): metadata_obj, Column("name", String(255)), Column("episodes", Integer), - Column("some_bool", BOOLEAN(create_constraint=False)), + Column("some_bool", BOOLEAN), Column("dollars", DECIMAL(10, 2)), ) @@ -240,7 +240,7 @@ class SampleObject(base): name = Column(String(255), primary_key=True) episodes = Column(Integer) - some_bool = Column(BOOLEAN(create_constraint=False)) + some_bool = Column(BOOLEAN) base.metadata.create_all() @@ -272,7 +272,7 @@ def test_dialect_type_mappings(base, db_engine, metadata_obj: MetaData): metadata_obj, Column("string_example", String(255)), Column("integer_example", Integer), - Column("boolean_example", BOOLEAN(create_constraint=False)), + Column("boolean_example", BOOLEAN), Column("decimal_example", DECIMAL(10, 2)), Column("date_example", Date), )