<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: cannot import name 'sql' from 'databricks' in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/38428#M26633</link>
    <description>&lt;P&gt;I resolve the same error installing library from cluster interface (UI)&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jul 2023 23:31:29 GMT</pubDate>
    <dc:creator>wallystart</dc:creator>
    <dc:date>2023-07-25T23:31:29Z</dc:date>
    <item>
      <title>cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27787#M19635</link>
      <description>&lt;P&gt;I am working on Databricks version 10.4 premium cluster and while importing sql from databricks module I am getting below error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; cannot import name 'sql' from 'databricks' (/databricks/python/lib/python3.8/site-packages/databricks/__init__.py).Trying to execute below sample code&lt;/P&gt;&lt;P&gt;from databricks import sql&lt;/P&gt;&lt;P&gt;import os&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with sql.connect(server_hostname = os.getenv("DATABRICKS_SERVER_HOSTNAME"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;http_path&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;= os.getenv("DATABRICKS_HTTP_PATH"),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;access_token&amp;nbsp;&amp;nbsp;= os.getenv("DATABRICKS_TOKEN")) as connection:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;with connection.cursor() as cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;cursor.execute("SELECT * FROM default.x LIMIT 2")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;result = cursor.fetchall()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;for row in result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(row)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ANy suggestion here&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 15:31:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27787#M19635</guid>
      <dc:creator>mickniz</dc:creator>
      <dc:date>2022-10-12T15:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27788#M19636</link>
      <description>&lt;P&gt;@Ritu Kumari​&amp;nbsp;ignore my last response lol Looks like you need to install this lib:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/dev-tools/python-sql-connector.html#package" target="test_blank"&gt;https://docs.databricks.com/dev-tools/python-sql-connector.html#package&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.databricks.com/dev-tools/python-sql-connector.html#id11" alt="https://docs.databricks.com/dev-tools/python-sql-connector.html#id11" target="_blank"&gt;Package&lt;/A&gt;&lt;/P&gt;&lt;P&gt;databricks-sql-connector&lt;/P&gt;&lt;P&gt;Usage:&amp;nbsp;&lt;/P&gt;&lt;P&gt;pip&amp;nbsp;install&amp;nbsp;databricks-sql-connector&lt;/P&gt;&lt;P&gt;See also&amp;nbsp;&lt;A href="https://pypi.org/project/databricks-sql-connector" alt="https://pypi.org/project/databricks-sql-connector" target="_blank"&gt;databricks-sql-connector&lt;/A&gt;&amp;nbsp;in the Python Package Index (PyPI).&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 16:05:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27788#M19636</guid>
      <dc:creator>Matt101122</dc:creator>
      <dc:date>2022-10-12T16:05:59Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27789#M19637</link>
      <description>&lt;P&gt;Just use natively spark.sql this way code is much faster and simpler you use the power of RDD. All you need is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;spark.sql("SELECT * FROM default.x LIMIT 2")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2022 16:50:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27789#M19637</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-10-12T16:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27790#M19638</link>
      <description>&lt;P&gt;Hi @Ritu Kumari​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or &lt;B&gt;mark an answer as best&lt;/B&gt;? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 06:28:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27790#M19638</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-20T06:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27791#M19639</link>
      <description>&lt;P&gt;Just currios, why did you use spark.sql  for your case I think it easy than import sql from databricks.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Nov 2022 12:08:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27791#M19639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-20T12:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27792#M19640</link>
      <description>&lt;P&gt;I basically used pyodbc&lt;/P&gt;&lt;P&gt;Spark sql is also way.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 07:05:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27792#M19640</guid>
      <dc:creator>mickniz</dc:creator>
      <dc:date>2022-11-21T07:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27793#M19641</link>
      <description>&lt;P&gt;There are 2 instances I got this error -&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Installing correct python package. Make sure you install "databricks.sql" module, not "databricks" module. Run below code in jupyter -&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;           %pip install databricks.sql&lt;/P&gt;&lt;P&gt;        2. The hostname, os.getenv("DATABRICKS_SERVER_HOSTNAME") returns, should NOT contain "https://". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please &lt;B&gt;upvote&lt;/B&gt; the answer if it solves your issue.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2023 10:59:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/27793#M19641</guid>
      <dc:creator>Sumit_Kumar</dc:creator>
      <dc:date>2023-04-04T10:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/38428#M26633</link>
      <description>&lt;P&gt;I resolve the same error installing library from cluster interface (UI)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 23:31:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/38428#M26633</guid>
      <dc:creator>wallystart</dc:creator>
      <dc:date>2023-07-25T23:31:29Z</dc:date>
    </item>
    <item>
      <title>cannot import name 'sql' from 'databricks'</title>
      <link>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/98609#M39756</link>
      <description>&lt;P&gt;if you ever received this kind of error after installing the correct Python package then try running the below command.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;dbutils.library.&lt;/SPAN&gt;&lt;SPAN&gt;restartPython&lt;/SPAN&gt;&lt;SPAN&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 13 Nov 2024 06:18:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/cannot-import-name-sql-from-databricks/m-p/98609#M39756</guid>
      <dc:creator>ameet9257</dc:creator>
      <dc:date>2024-11-13T06:18:16Z</dc:date>
    </item>
  </channel>
</rss>

