From b86895c6d118fd762259b2080eb823267670eb70 Mon Sep 17 00:00:00 2001 From: Shashank Koppar Date: Mon, 16 Aug 2021 12:29:22 +0200 Subject: [PATCH 1/4] try add LowCardinality(Nullable(String)) --- connector.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/connector.py b/connector.py index 5ae983d..ed8d976 100644 --- a/connector.py +++ b/connector.py @@ -84,18 +84,21 @@ def create_ad_hoc_field(cls, db_type): if db_type == 'LowCardinality(String)': db_type = 'String' + if db_type == 'LowCardinality(Nullable(String))': + db_type = 'String' + if db_type.startswith('DateTime'): db_type = 'DateTime' if db_type.startswith('Nullable'): inner_field = cls.create_ad_hoc_field(db_type[9 : -1]) return orm_fields.NullableField(inner_field) - + # db_type for Deimal comes like 'Decimal(P, S) string where P is precision and S is scale' if db_type.startswith('Decimal'): nums = [int(n) for n in db_type[8:-1].split(',')] return orm_fields.DecimalField(nums[0], nums[1]) - + # Simple fields name = db_type + 'Field' if not hasattr(orm_fields, name): From 710933dada31aca2bf91dd72d29557be8c00afd4 Mon Sep 17 00:00:00 2001 From: H Shashank Koppar Date: Tue, 8 Mar 2022 16:40:26 +0100 Subject: [PATCH 2/4] add bool --- connector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connector.py b/connector.py index ed8d976..83fe601 100644 --- a/connector.py +++ b/connector.py @@ -84,6 +84,9 @@ def create_ad_hoc_field(cls, db_type): if db_type == 'LowCardinality(String)': db_type = 'String' + if db_type == 'Bool': + db_type = 'UInt8' + if db_type == 'LowCardinality(Nullable(String))': db_type = 'String' From 0f46dfad506229713af41dee6e1a36a75405ae21 Mon Sep 17 00:00:00 2001 From: Shashank Koppar Date: Wed, 13 Jul 2022 15:35:39 +0200 Subject: [PATCH 3/4] try updating dialects --- setup.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 9ccecf5..c0f204e 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,16 @@ VERSION = [0, 1, 5] readme = open('README.rst').read() +dialects = [ + 'clickhouse{}=sqlalchemy_clickhouse.{}'.format(driver, d_path) + + for driver, d_path in [ + ('', 'base:ClickHouseDialect'), + ('.http', 'base:ClickHouseDialect'), + ('.native', 'base:ClickHouseDialect') + ] +] + setup( name='sqlalchemy-clickhouse', version='.'.join('%d' % v for v in VERSION[0:3]), @@ -32,9 +42,7 @@ 'sqlalchemy_clickhouse': ['LICENSE.txt'], }, entry_points={ - 'sqlalchemy.dialects': [ - 'clickhouse=sqlalchemy_clickhouse.base', - ] + 'sqlalchemy.dialects': dialects }, classifiers = [ 'Development Status :: 5 - Production/Stable', From 23e71ba22ec9656d178d691d578c960175cf4c49 Mon Sep 17 00:00:00 2001 From: H Shashank Koppar Date: Thu, 29 Sep 2022 11:55:38 +0200 Subject: [PATCH 4/4] add Map(String, UInt64) --- connector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/connector.py b/connector.py index 83fe601..4733d26 100644 --- a/connector.py +++ b/connector.py @@ -90,6 +90,9 @@ def create_ad_hoc_field(cls, db_type): if db_type == 'LowCardinality(Nullable(String))': db_type = 'String' + if db_type == 'Map(String, UInt64)': + db_type = 'String' + if db_type.startswith('DateTime'): db_type = 'DateTime'