-
-
Notifications
You must be signed in to change notification settings - Fork 130
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 IPv4 and IPv6 types support #52
Conversation
Great. I'll review PR in a couple of weeks. I'm on vacation right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else looks good for me.
clickhouse_sqlalchemy/types.py
Outdated
|
||
def bind_processor(self, dialect): | ||
def process(value): | ||
return unicode(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is compatible helper for this.
from .util import compat
return compat.text_type(text)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops didn't see it, fixed!
setup.py
Outdated
install_requires = [ | ||
'sqlalchemy>=1.2', | ||
'requests', | ||
'clickhouse_driver>=0.0.14' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've bumped clickhouse-driver version to 0.0.19 for ip addresses support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version bumped
This PR adds IPv4 and IPv6 support in sqlalchemy, following the work done in clickhouse-driver.
Note that as no release of clickhouse-driver with IP support is available in pip yet, travis will fail for now. Nonetheless all tests are passing on my computer on python 3.6 and 2.7 (with clickhouse 19.3.3+).
I have also added the require_server_version decorator to be used in tests so IP related tests run only on 19.3.3+
Finally as clickhouse only support basic comparators for IP, I have added the in and not in operators to generate proper queries, see tests for examples.