我在Pycharm databricks-sql-connector安裝。
然後我運行下麵的查詢基於文檔。
我參考這個文檔。
(https://docs.www.eheci.com/dev-tools/python-sql-connector.html)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
從磚導入sql
進口操作係統
與sql。連接(server_hostname = os.getenv (“* * *”),
http_path = os.getenv (“* * *”),
access_token = os.getenv(" * * * "))作為連接:
光標connection.cursor ():
遊標。執行(“SELECT * FROM違約。鑽石限製2”)
結果= cursor.fetchall ()
一行的結果:
打印(行)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
然而,我麵對下麵的錯誤。
(AttributeError:“NoneType”對象沒有屬性“startswith”)
用戶文件“C: \ \ MZC01-SSLEE \ PycharmProjects \ sqlconnector \ venv \ lib \網站\磚\ sql \ __init__。py”, 50行,在連接
返回連接(server_hostname http_path access_token, * * kwargs)
用戶文件“C: \ \ MZC01-SSLEE \ PycharmProjects \ sqlconnector \ venv \ lib \網站\磚\ sql \客戶機。__init__ py”, 156行
auth_provider = get_python_sql_connector_auth_provider (
用戶文件“C: \ \ MZC01-SSLEE \ PycharmProjects \ sqlconnector \ venv \ lib \網站\磚\ sql \身份驗證\身份驗證。在get_python_sql_connector_auth_provider py”, 84行
主機名= normalize_host_name(主機名),
用戶文件“C: \ \ MZC01-SSLEE \ PycharmProjects \ sqlconnector \ venv \ lib \網站\磚\ sql \身份驗證\身份驗證。在normalize_host_name py”, 77行
maybe_scheme = " https:// "如果不是hostname.startswith其他(“https://”) "
AttributeError:“NoneType”對象沒有屬性“startswith”
你能給我一些建議來解決這個嗎?