-
-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Description
Describe the bug
For a table DDL like this:
CREATE TABLE IF NOT EXISTS bugtable on cluster 'local' (
id Int,
metadata Map(String, Map(String, Nullable(String)))
) ENGINE = MergeTree()
order by id
Reflection using get_columns() fails with Map.__init__() missing 1 required positional argument: 'value_type'
It looks like the issue is in this code
clickhouse-sqlalchemy/clickhouse_sqlalchemy/drivers/base.py
Lines 242 to 248 in a3140a9
| elif spec.startswith('Map'): | |
| inner = spec[4:-1] | |
| coltype = self.ischema_names['_map'] | |
| inner_types = [ | |
| self._get_column_type(name, t.strip()) | |
| for t in inner.split(',') | |
| ] |
.split(',') is getting an input of String, Map(String, Nullable(String)) and splits it to [String, 'Map(String', 'Nullable(String))'] - it doesn't respect the parentheses. It could probably be replaced with a .split(',', maxsplit=1) to fix this issue (unless the key type was also complex, but that seems less likely)
Expected behavior
This should get reflected properly.
Originally discovered in the DataHub slack community: https://datahubspace.slack.com/archives/CUMUWQU66/p1698241313514559?thread_ts=1698112545.709559&cid=CUMUWQU66
ppecheux, coca-alex and ne1r0n
Metadata
Metadata
Assignees
Labels
No labels