Skip to content

Commit

Permalink
Disable non_native_boolean_check_constraint (#120)
Browse files Browse the repository at this point in the history
---------
Signed-off-by: Bogdan Kyryliuk <b.kyryliuk@gmail.com>
Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
Co-authored-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
  • Loading branch information
bkyryliuk authored Jul 12, 2023
1 parent 1eef432 commit ec58144
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/databricks/sqlalchemy/dialect/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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):
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/sqlalchemy/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)),
)

Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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),
)
Expand Down

0 comments on commit ec58144

Please sign in to comment.