Skip to content

Disable non_native_boolean_check_constraint #120

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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