<?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 input_file_name() not supported in Unity Catalog in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16042#M10264</link>
    <description>&lt;P&gt;Hey, so our notebooks reading a bunch of json files from storage typically use a input_file_name() when moving from raw to bronze, but after upgrading to Unity Catalog we get an error message:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AnalysisException: [UC_COMMAND_NOT_SUPPORTED] input_file_name is not supported in Unity Catalog.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Why is this? Are we following a bad practice by wanting to have filenames for tracing data through the different storage layers? Does Unity Catalog perhaps do this automatically in some way? Just barely started testing Unity Catalog, so struggling a bit to grasp what the differences are. I thought it was merely a tool that did some stuff automatically (lineage etc) and gave us a simple metastore to interact with. &lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2022 07:54:36 GMT</pubDate>
    <dc:creator>espenol</dc:creator>
    <dc:date>2022-12-19T07:54:36Z</dc:date>
    <item>
      <title>input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16042#M10264</link>
      <description>&lt;P&gt;Hey, so our notebooks reading a bunch of json files from storage typically use a input_file_name() when moving from raw to bronze, but after upgrading to Unity Catalog we get an error message:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;AnalysisException: [UC_COMMAND_NOT_SUPPORTED] input_file_name is not supported in Unity Catalog.;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Why is this? Are we following a bad practice by wanting to have filenames for tracing data through the different storage layers? Does Unity Catalog perhaps do this automatically in some way? Just barely started testing Unity Catalog, so struggling a bit to grasp what the differences are. I thought it was merely a tool that did some stuff automatically (lineage etc) and gave us a simple metastore to interact with. &lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 07:54:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16042#M10264</guid>
      <dc:creator>espenol</dc:creator>
      <dc:date>2022-12-19T07:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16043#M10265</link>
      <description>&lt;P&gt;Hi @Espen Solvang​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for reaching out to us. Python UDF / UDAFs or Pandas UDFS are currently not supported in Shared Unity Catalog clusters. Instead, please change the mode to "&lt;B&gt;Single User&lt;/B&gt;". This should support input_file_name.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 12:01:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16043#M10265</guid>
      <dc:creator>Cedric</dc:creator>
      <dc:date>2022-12-19T12:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16044#M10266</link>
      <description>&lt;P&gt;Thanks a lot for your response. I'll give it a try and get back to you. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure I understand that input_file_name() is an UDF - I didn't write it myself, it's imported from pyspark. I guess what you are saying is that it still is an UDF, please correct me if I'm wrong. &lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 07:04:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16044#M10266</guid>
      <dc:creator>espenol</dc:creator>
      <dc:date>2022-12-20T07:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16045#M10267</link>
      <description>&lt;P&gt;I can't answer the question of why input_file_name() doesn't work with the unity catalog, but I did manage to find a workaround, using the file metadata.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can basically query the _metadata field, which will give you a json string with file path, name, size and modified datetime.  So something like this should work;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select. _metadata['file_name'], *
from my_catalog.my_schema.my_table&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:22:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16045#M10267</guid>
      <dc:creator>najmead</dc:creator>
      <dc:date>2023-01-30T06:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16046#M10268</link>
      <description>&lt;P&gt;Hi @Cedric Law Hing Ping​,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there any plans to support input_file_name in Unity Catalog? I'm using Unity Catalog in Delta Live Tables (DLT), which is in preview, and would like to let DLT handle what cluster is used and still be able to use input_file_name for traceability.&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 10:50:12 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/16046#M10268</guid>
      <dc:creator>Magnus</dc:creator>
      <dc:date>2023-05-12T10:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/37909#M26506</link>
      <description>&lt;P&gt;I have to say that I ran into these undocumented restrictions multiple times with the shared instance and it's annoying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2023 23:20:27 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/37909#M26506</guid>
      <dc:creator>harraz</dc:creator>
      <dc:date>2023-07-18T23:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/37910#M26507</link>
      <description>&lt;P&gt;this wont work if you are creating a table for the first time from the stream, for example the code below when running for the first time. I need a way to capture the file name going in the stream&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;# Configure Auto Loader &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;streaming_query = (spark.readStream&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;format&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"cloudFiles"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"cloudFiles.format"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"csv"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"cloudFiles.schemaLocation"&lt;/SPAN&gt;&lt;SPAN&gt;, raw_checkpoint_path)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"sep"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"|"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"inferSchema"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"true"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"lineSep"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"\r\n"&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;# Specify the Windows-style EOL character (CRLF)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"pathGlobfilter"&lt;/SPAN&gt;&lt;SPAN&gt;, file_pattern)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.load(&lt;/SPAN&gt;&lt;SPAN&gt;f"&lt;/SPAN&gt;&lt;SPAN&gt;{file_path}&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.select(&lt;/SPAN&gt;&lt;SPAN&gt;"*"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;FONT face="impact,chicago"&gt; input_file_name()&lt;/FONT&gt;.alias(&lt;/SPAN&gt;&lt;SPAN&gt;"source_file"&lt;/SPAN&gt;&lt;SPAN&gt;), current_timestamp().alias(&lt;/SPAN&gt;&lt;SPAN&gt;"processing_time"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.writeStream&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.option(&lt;/SPAN&gt;&lt;SPAN&gt;"checkpointLocation"&lt;/SPAN&gt;&lt;SPAN&gt;, raw_checkpoint_path)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.trigger(availableNow=&lt;/SPAN&gt;&lt;SPAN&gt;True&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.toTable(raw_table_name))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Jul 2023 23:44:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/37910#M26507</guid>
      <dc:creator>harraz</dc:creator>
      <dc:date>2023-07-18T23:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/52475#M29446</link>
      <description>&lt;P&gt;I had the similar issue with the Unity Catalog updrage, found the following solution working, based on the documentation -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/functions/input_file_name" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/functions/input_file_name&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt; .selectExpr("*", "_metadata as source_metadata")
  # .withColumn('file_path', input_file_name())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2023 04:21:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/52475#M29446</guid>
      <dc:creator>datahero</dc:creator>
      <dc:date>2023-11-17T04:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/55688#M30410</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;withColumn&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"RECORD_FILE_NAME"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;col&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"_metadata.file_name"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Will work for spark.read to get the file name, or:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;withColumn&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"RECORD_FILE_NAME"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;col&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"_metadata.file_path"&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;BR /&gt;&lt;BR /&gt;To get the whole file path&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 22 Dec 2023 20:03:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/55688#M30410</guid>
      <dc:creator>JasonThomas</dc:creator>
      <dc:date>2023-12-22T20:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/62501#M31980</link>
      <description>&lt;P&gt;This worked perfectly for me. &amp;nbsp;The error message mentioned _metadata.file_path as an alternative to input_file_name, but it wasn't clear how to reference it. &amp;nbsp;Thanks for making it clear that its technically a column that's available. &amp;nbsp;I'm going to explore what else is available in _metadata. &amp;nbsp;&lt;STRONG&gt;This should be marked as the solution in my opinion.&lt;/STRONG&gt; Thanks again. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Mar 2024 08:13:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/62501#M31980</guid>
      <dc:creator>mgiglia</dc:creator>
      <dc:date>2024-03-03T08:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/129046#M48423</link>
      <description>&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65999"&gt;@harraz&lt;/a&gt;-&amp;nbsp;Replace&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.select("*",&lt;FONT face="impact,chicago"&gt;&amp;nbsp;input_file_name()&lt;/FONT&gt;.alias("source_file"), current_timestamp().alias("processing_time"))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;with&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;selectExpr&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"*"&lt;/SPAN&gt;&lt;SPAN&gt;,"_metadata.file_path as source_file",&lt;/SPAN&gt;&lt;SPAN&gt;"current_timestamp() as processing_time"&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 Aug 2025 22:26:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/129046#M48423</guid>
      <dc:creator>nachoBot</dc:creator>
      <dc:date>2025-08-20T22:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: input_file_name() not supported in Unity Catalog</title>
      <link>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/142720#M52014</link>
      <description>&lt;P&gt;The reason why the 'input_file_name' is not supported because this function was available in older versions of Databricks runtime. It got deprecated from Databricks Runtime 13.3 LTS onwards&lt;/P&gt;</description>
      <pubDate>Wed, 31 Dec 2025 01:17:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/input-file-name-not-supported-in-unity-catalog/m-p/142720#M52014</guid>
      <dc:creator>ramanpreet</dc:creator>
      <dc:date>2025-12-31T01:17:06Z</dc:date>
    </item>
  </channel>
</rss>

