1、問題:
在Superset安裝好後,SQL查詢數據會出現如下錯誤:“module" object has no attribute 'SIGALRM'
2、問題原因:
由於 Windows 環境下依賴包不兼容導致的 —— Python 的 signal 包只作用於 Linux 和 Mac ,在 Windows 下不啓作用。
3、解決辦法:
(1)首先,從頂部導航菜單的 Sources-->Databases 進入數據庫的列表頁,選中數據庫進行編輯,將 Expose in SQL Lab 和 Allow Run Sync 都勾選上,其餘的不要勾選。
a. 英文版:
b. 漢語版:
(2)在 superset/utils.py 下找到相關代碼,把 signal
所在行都註釋,然後再加上一個 pass
(這塊代碼的功能是在超時後將查詢進程殺掉,註釋後沒大影響)。
def __enter__(self):
try:
pass
#signal.signal(signal.SIGALRM, self.handle_timeout)
#signal.alarm(self.seconds)
except ValueError as e:
logging.warning("timeout can't be used in the current context")
logging.exception(e)
def __exit__(self, type, value, traceback):
try:
pass
#signal.alarm(0)
except ValueError as e:
logging.warning("timeout can't be used in the current context")
logging.exception(e)
(3)重新操作查詢,發現完美解決。