我最近从 QuestDB 7.4.2 升级到 QuestDB 8.1.2。我使用 Apache Superset 4.0.0 进行可视化,在升级之前这工作得很好,但现在
questdb-connect
库抛出了一个无用的错误:
2024-10-28T13:28:21.521208472Z ERROR:flask_appbuilder.api:'NoneType' object is not callable
2024-10-28T13:28:21.521233355Z Traceback (most recent call last):
2024-10-28T13:28:21.521237176Z File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps
2024-10-28T13:28:21.521240585Z return f(self, *args, **kwargs)
2024-10-28T13:28:21.521242959Z File "/app/superset/views/base_api.py", line 127, in wraps
2024-10-28T13:28:21.521245388Z raise ex
2024-10-28T13:28:21.521248040Z File "/app/superset/views/base_api.py", line 121, in wraps
2024-10-28T13:28:21.521250464Z duration, response = time_function(f, self, *args, **kwargs)
2024-10-28T13:28:21.521253488Z File "/app/superset/utils/core.py", line 1463, in time_function
2024-10-28T13:28:21.521255789Z response = func(*args, **kwargs)
2024-10-28T13:28:21.521258381Z File "/app/superset/utils/log.py", line 255, in wrapper
2024-10-28T13:28:21.521261480Z value = f(*args, **kwargs)
2024-10-28T13:28:21.521263836Z File "/app/superset/databases/api.py", line 742, in table_metadata
2024-10-28T13:28:21.521266910Z table_info = get_table_metadata(database, table_name, schema_name)
2024-10-28T13:28:21.521269293Z File "/app/superset/databases/utils.py", line 67, in get_table_metadata
2024-10-28T13:28:21.521271766Z columns = database.get_columns(table_name, schema_name)
2024-10-28T13:28:21.521274575Z File "/app/superset/models/core.py", line 839, in get_columns
2024-10-28T13:28:21.521277035Z return self.db_engine_spec.get_columns(
2024-10-28T13:28:21.521279705Z File "/app/superset/db_engine_specs/base.py", line 1340, in get_columns
2024-10-28T13:28:21.521282333Z cast(list[SQLAColumnType], inspector.get_columns(table_name, schema))
2024-10-28T13:28:21.521284920Z File "/usr/local/lib/python3.10/site-packages/questdb_connect/inspector.py", line 79, in get_columns
2024-10-28T13:28:21.521287336Z return self.format_table_columns(table_name, result_set)
2024-10-28T13:28:21.521289845Z File "/usr/local/lib/python3.10/site-packages/questdb_connect/inspector.py", line 87, in format_table_columns
2024-10-28T13:28:21.521292427Z return [
2024-10-28T13:28:21.521294748Z File "/usr/local/lib/python3.10/site-packages/questdb_connect/inspector.py", line 90, in <listcomp>
2024-10-28T13:28:21.521297122Z "type": resolve_type_from_name(row[1])(),
2024-10-28T13:28:21.521299536Z TypeError: 'NoneType' object is not callable
我不确定出了什么问题,对 Superset 的支持是否已停止?为什么我的代码不能再工作了?
在 QuestDB 8.0.0 及更高版本中,有 UTF-8 Encoded
VARCHAR
类型可用。建议尽可能使用它而不是 STRING
,因为它通常需要更少的存储空间,并提高查询性能。
但是,
questdb-connect
库还不支持这种类型,仅支持STRING
。因此,如果您尝试连接到表并从 VARCHAR
列检索数据,连接器可能会损坏。
最有可能的是,您将一些
STRING
列交换为 VARCHAR
,现在遇到了这种不兼容性。
要解决此问题,您可以:
STRING
类型。VARCHAR
列或值转换为 STRING
。对于选项 1,您可以使用以下 SQL:
ALTER TABLE table_name ALTER COLUMN column_name TYPE STRING;
对于选项 2,只需使用强制转换语法
SELECT v::STRING, cast(v as STRING)
希望
questdb-connect
能够尽快更新,以按预期使用 VARCHAR
类型。