Skip to content
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

Add native Boolean type (Bool) #213

Merged
merged 5 commits into from
Nov 8, 2022

Conversation

AntonFriberg
Copy link
Contributor

Could not find any relevant doc entries to update.

Note, I changed the ClickHouseDialect configuration supports_native_boolean to True. This seemed like a reasonable thing to do but I am not sure exactly how that effects things? Similarly, non_native_boolean_check_constraint is kept as is but I do not know what this does either.

With these changes I got it to work as I would like and it allows Alembic migrations for tables with Boolean columns.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Ensure PR doesn't contain untouched code reformatting: spaces, etc.
  • Run flake8 and fix issues.
  • Run pytest no tests failed. See https://clickhouse-driver.readthedocs.io/en/latest/development.html.

Add Boolean type based on sqlalchemy Boolean type.

Change-Id: I579d2f025ff1cf975e026ed8c29c249ab2d27a1a
Interpret both 'Bool' and 'Boolean' as the ClickHouse Bool/Boolean type.

In ClickHouse Boolean is an alias for Bool.

Change-Id: I269e38573dde3c918dc5d36f430aaaa9703bf830
Previously Boolean type was replaced with UInt8 type since no Boolean
type existed. This changes so that native 'Bool' type representation is
used instead.

Change-Id: I2d93d3cd66ab1cb59bd55af08cda9114efb065d8
Since ClickHouse now does support native Boolean types we change the
ClickHouseDialect configuration accordingly.

Change-Id: I331b0d219389dafe16a03ebb0eb3d3b48de7a736
Change-Id: I17840a395dfe159bc42a9b149a32caecc3e47229
@AntonFriberg
Copy link
Contributor Author

@xzkostyan feel free to approve workflows when you have time!

@AntonFriberg
Copy link
Contributor Author

Also, these changes will not work for ClickHouse server versions below v21.12 but no such releases have been made since 2022-01-26 and current stable and lts are both later than that.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 83.594% when pulling 9b86f3f on AntonFriberg:add-native-boolean-type into e587a47 on xzkostyan:master.

@xzkostyan xzkostyan merged commit c69984f into xzkostyan:master Nov 8, 2022
@AntonFriberg AntonFriberg deleted the add-native-boolean-type branch November 8, 2022 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Boolean ClickHouse type
3 participants