<?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: Making py connector to raise an error for wrong SQL when asking to plan a query in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16966#M11052</link>
    <description>&lt;P&gt;Hi' I'm still searching for a more suited solution to my use case.&lt;/P&gt;&lt;P&gt;Installing pyspark seems too much (build time and extra packages I don't really need).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to make this a feature request?&lt;/P&gt;</description>
    <pubDate>Sun, 31 Jul 2022 08:04:22 GMT</pubDate>
    <dc:creator>624398</dc:creator>
    <dc:date>2022-07-31T08:04:22Z</dc:date>
    <item>
      <title>Making py connector to raise an error for wrong SQL when asking to plan a query</title>
      <link>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16962#M11048</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My aim is to validate a given SQL string without actually running it.&lt;/P&gt;&lt;P&gt;I thought I could use the `EXPLAIN` statement to do so.&lt;/P&gt;&lt;P&gt;So I tried using the `databricks-sql-connector` for python to explain a query, and so determine whether it's valid or not. Example python code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&lt;B&gt;import &lt;/B&gt;databricks.sql&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;with &lt;/B&gt;databricks.sql.connect(...) &lt;B&gt;as &lt;/B&gt;connection:&lt;/P&gt;&lt;P&gt;    &lt;B&gt;with &lt;/B&gt;connection.cursor() &lt;B&gt;as &lt;/B&gt;cursor:&lt;/P&gt;&lt;P&gt;        cursor.execute(&lt;B&gt;"EXPLAIN SELECT BAD-QUERY AS FOO"&lt;/B&gt;)&lt;/P&gt;&lt;P&gt;        r = cursor.fetchall()&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with that implementation is that the driver does not throws an error, but instead retrieves me a string containing the error details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why it's a problem? I need to parse the string result to distinguish if the explained query was valid or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I was wondering if there some kind of setting / parameter / configuration or so I can use to change the described above result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in Advance!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 10:17:50 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16962#M11048</guid>
      <dc:creator>624398</dc:creator>
      <dc:date>2022-06-22T10:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Making py connector to raise an error for wrong SQL when asking to plan a query</title>
      <link>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16963#M11049</link>
      <description>&lt;P&gt;Please try in pyspark:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;try:
   spark.sql("SELECT  BAD-QUERY AS FOO")._jdf.queryExecution().toString()
except:
   print("incorrect query")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;or just:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;try:
   spark.sql("SELECT  BAD-QUERY AS FOO").explain()
except:
   print("incorrect query")&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 20:05:46 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16963#M11049</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2022-06-23T20:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Making py connector to raise an error for wrong SQL when asking to plan a query</title>
      <link>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16965#M11051</link>
      <description>&lt;P&gt;Hi @Hubert Dudek​, thanks for replying!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The optimal solution I was looking for was in the databricks-sql-connector.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Installing large package such pyspark for this specific feature seems too much for my project purposes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Sun, 03 Jul 2022 09:07:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16965#M11051</guid>
      <dc:creator>624398</dc:creator>
      <dc:date>2022-07-03T09:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Making py connector to raise an error for wrong SQL when asking to plan a query</title>
      <link>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16966#M11052</link>
      <description>&lt;P&gt;Hi' I'm still searching for a more suited solution to my use case.&lt;/P&gt;&lt;P&gt;Installing pyspark seems too much (build time and extra packages I don't really need).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to make this a feature request?&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jul 2022 08:04:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/making-py-connector-to-raise-an-error-for-wrong-sql-when-asking/m-p/16966#M11052</guid>
      <dc:creator>624398</dc:creator>
      <dc:date>2022-07-31T08:04:22Z</dc:date>
    </item>
  </channel>
</rss>

