<?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: [DeltaTable] Usage with Unity Catalog (ParseException) in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/99518#M8732</link>
    <description>&lt;P&gt;Same here:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;pyspark&lt;/SPAN&gt;=&lt;SPAN&gt;"3.5.3"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;delta-spark&lt;/SPAN&gt;=&lt;SPAN&gt;"3.2.1"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;LI-CODE lang="python"&gt;spark.sql("SHOW CATALOGS").show()
spark.sql("SHOW TABLES IN mycatalog.myschema").show()
spark.sql("DESCRIBE mycatalog.myschema.mytable").show()&lt;/LI-CODE&gt;&lt;P&gt;Code above is working with&amp;nbsp;&lt;SPAN&gt;the&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;three-level notation&lt;/EM&gt;&lt;SPAN&gt;. (catalog.database.table)&lt;BR /&gt;&lt;BR /&gt;When using the&amp;nbsp;&lt;EM&gt;three-level notation &lt;/EM&gt;with following code, the same error occurs:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from delta import DeltaTable
dt = DeltaTable.forName(spark, "mycatalog.myschema.mytable")&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
File "/workspace/test.py", line 13, in &amp;lt;module&amp;gt;
dt = DeltaTable.forName(spark, "mycatalog.myschema.mytable")
File "/venv/lib/python3.10/site-packages/delta/tables.py", line 419, in forName
jdt = jvm.io.delta.tables.DeltaTable.forName(jsparkSession, tableOrViewName)
File "/venv/lib/python3.10/site-packages/py4j/java_gateway.py", line 1322, in __call__
return_value = get_return_value(
File "/venv/lib/python3.10/site-packages/pyspark/errors/exceptions/captured.py", line 185, in deco
raise converted from None
pyspark.errors.exceptions.captured.ParseException:
[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 11)

== SQL ==
mycatalog.myschema.mytable
------------------^^^&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2024 13:39:49 GMT</pubDate>
    <dc:creator>PTangelder</dc:creator>
    <dc:date>2024-11-20T13:39:49Z</dc:date>
    <item>
      <title>[DeltaTable] Usage with Unity Catalog (ParseException)</title>
      <link>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/39453#M8728</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm migrating my workspaces to &lt;STRONG&gt;Unity Catalog&lt;/STRONG&gt;&amp;nbsp;and the application to use &lt;EM&gt;three-level notation&lt;/EM&gt;. (catalog.database.table)&lt;/P&gt;&lt;P&gt;See:&amp;nbsp;&lt;A href="https://docs.databricks.com/en/delta/tutorial.html#tutorial-delta-lake" target="_blank" rel="noopener"&gt;Tutorial: Delta Lake | Databricks on AWS&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I'm having the following exception when trying to use &lt;STRONG&gt;DeltaTable.forName(string name)&lt;/STRONG&gt; or &lt;STRONG&gt;DeltaTable.tableName(string name)&lt;/STRONG&gt; with three-level notation such as &lt;EM&gt;catalog.database.table&lt;/EM&gt; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;org.apache.spark.sql.catalyst.parser.ParseException :
[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 18)

== SQL ==
spark_catalog.Gold.FactSyPerson
------------------^^^
at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:306)
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:144)
at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:52)
at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parseTableIdentifier(ParseDriver.scala:54)
at io.delta.sql.parser.DeltaSqlParser.parseTableIdentifier(DeltaSqlParser.scala:138)
at io.delta.tables.DeltaTable$.forName(DeltaTable.scala:783)
at io.delta.tables.DeltaTable$.forName(DeltaTable.scala:770)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like it's not supported yet, could you please help? Is there a workaround?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 15:04:35 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/39453#M8728</guid>
      <dc:creator>Ludo</dc:creator>
      <dc:date>2023-08-09T15:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: [DeltaTable] Usage with Unity Catalog (ParseException)</title>
      <link>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/39472#M8729</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/28393"&gt;@Ludo&lt;/a&gt;&amp;nbsp;I am able to access the table using 3 level namespace.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saipujari_spark_0-1691610542456.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/3106i0A557ECC2527D1A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saipujari_spark_0-1691610542456.png" alt="saipujari_spark_0-1691610542456.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;make sure&lt;/P&gt;&lt;P&gt;1. you are using a Unity catalog-enabled cluster&lt;/P&gt;&lt;P&gt;2. try using the latest DBR&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 19:50:19 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/39472#M8729</guid>
      <dc:creator>saipujari_spark</dc:creator>
      <dc:date>2023-08-09T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: [DeltaTable] Usage with Unity Catalog (ParseException)</title>
      <link>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/39510#M8730</link>
      <description>&lt;P&gt;Thank you for the quick feedback&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/627"&gt;@saipujari_spark&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Indeed, it's working great within a notebook with Databricks Runtime 13.2 which most likely has a custom behavior for unity catalog.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not working in my scala application running in local with direct use of delta-core libraries 2.4.0. (no databricks runtime locally) There is a missing piece of software within delta-core libraries I guess.&lt;/P&gt;&lt;P&gt;I hope it will be updated soon if my understanding is correct.&lt;/P&gt;&lt;P&gt;Nevertheless, spark libraries are ready thanks to this MR =&amp;gt;&amp;nbsp;&lt;A href="https://issues.apache.org/jira/browse/SPARK-39235" target="_blank"&gt;[SPARK-39235] Make Catalog API be compatible with 3-layer-namespace - ASF JIRA (apache.org)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 13:16:09 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/39510#M8730</guid>
      <dc:creator>Ludo</dc:creator>
      <dc:date>2023-08-10T13:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: [DeltaTable] Usage with Unity Catalog (ParseException)</title>
      <link>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/93319#M8731</link>
      <description>&lt;P&gt;Hi guys, I also faced the same problem but with Pyspark API inside unit tests, mainly the problem happens when we are building standalone spark session with support of delta extesnsion, inside pyspark this still does not work,&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;pyspark&lt;/SPAN&gt;=&lt;SPAN&gt;"3.5.3"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;delta-spark&lt;/SPAN&gt;=&lt;SPAN&gt;"3.2.1"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;for example I have fixture like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    @pytest.mark.usefixtures("spark_session")
    def test_join_operation_with_catalog(self, spark_session: SparkSession):
        source_schema = StructType([
            StructField("id", StringType(), True),
            StructField("derived_column", StringType(), True),
            StructField("filter_column", StringType(), True)
        ])

        spark_session.sql("CREATE SCHEMA source")
        spark_session.sql("DROP TABLE IF EXISTS spark_catalog.source.source_table_join")
        spark_session.catalog.setCurrentCatalog("spark_catalog")
        spark_session.catalog.setCurrentDatabase("source")
        
        DeltaTable.createOrReplace(spark_session).tableName("source_table_join").addColumns(
                    source_schema).execute()

        try:
            print(DeltaTable.forName(spark_session, "source.source_table_join").toDF().collect())
            print('SUCCESS')
        except Exception as err:
            print("FAILURE")
            print(err)&lt;/LI-CODE&gt;&lt;LI-CODE lang="python"&gt;@pytest.fixture(scope="session")
def spark_session():
    shutil.rmtree("spark-warehouse", ignore_errors=True)

    os.environ['PYSPARK_PYTHON'] = sys.executable
    os.environ['PYSPARK_DRIVER_PYTHON'] = sys.executable
    builder = (SparkSession.builder
             .master("local[*]")
             .config("spark.jars.packages", "io.delta:delta-core_2.12:2.3.0")
             .config("spark.sql.extensions", "io.delta.sql.DeltaSparkSessionExtension")
             .config("spark.databricks.delta.schema.autoMerge.enabled", "true") 
             .config("spark.sql.catalog.spark_catalog", "org.apache.spark.sql.delta.catalog.DeltaCatalog")
             .appName("test")
    )
    yield configure_spark_with_delta_pip(builder).getOrCreate()
    
    shutil.rmtree("spark-warehouse", ignore_errors=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;at the end it will thrown with Parsing exception like&amp;nbsp;&lt;/P&gt;&lt;P&gt;[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 20)&lt;/P&gt;&lt;P&gt;== SQL ==&lt;BR /&gt;spark_catalog.source.source_table_join&lt;BR /&gt;--------------------^^^&lt;BR /&gt;and&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;DeltaTable.createOrReplace also does not work if I use full qualified name catalog.schema.table&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 15:23:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/93319#M8731</guid>
      <dc:creator>eniqen</dc:creator>
      <dc:date>2024-10-09T15:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: [DeltaTable] Usage with Unity Catalog (ParseException)</title>
      <link>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/99518#M8732</link>
      <description>&lt;P&gt;Same here:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;pyspark&lt;/SPAN&gt;=&lt;SPAN&gt;"3.5.3"&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;delta-spark&lt;/SPAN&gt;=&lt;SPAN&gt;"3.2.1"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;LI-CODE lang="python"&gt;spark.sql("SHOW CATALOGS").show()
spark.sql("SHOW TABLES IN mycatalog.myschema").show()
spark.sql("DESCRIBE mycatalog.myschema.mytable").show()&lt;/LI-CODE&gt;&lt;P&gt;Code above is working with&amp;nbsp;&lt;SPAN&gt;the&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;three-level notation&lt;/EM&gt;&lt;SPAN&gt;. (catalog.database.table)&lt;BR /&gt;&lt;BR /&gt;When using the&amp;nbsp;&lt;EM&gt;three-level notation &lt;/EM&gt;with following code, the same error occurs:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from delta import DeltaTable
dt = DeltaTable.forName(spark, "mycatalog.myschema.mytable")&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
File "/workspace/test.py", line 13, in &amp;lt;module&amp;gt;
dt = DeltaTable.forName(spark, "mycatalog.myschema.mytable")
File "/venv/lib/python3.10/site-packages/delta/tables.py", line 419, in forName
jdt = jvm.io.delta.tables.DeltaTable.forName(jsparkSession, tableOrViewName)
File "/venv/lib/python3.10/site-packages/py4j/java_gateway.py", line 1322, in __call__
return_value = get_return_value(
File "/venv/lib/python3.10/site-packages/pyspark/errors/exceptions/captured.py", line 185, in deco
raise converted from None
pyspark.errors.exceptions.captured.ParseException:
[PARSE_SYNTAX_ERROR] Syntax error at or near '.'.(line 1, pos 11)

== SQL ==
mycatalog.myschema.mytable
------------------^^^&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2024 13:39:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/deltatable-usage-with-unity-catalog-parseexception/m-p/99518#M8732</guid>
      <dc:creator>PTangelder</dc:creator>
      <dc:date>2024-11-20T13:39:49Z</dc:date>
    </item>
  </channel>
</rss>

