<?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: How to load PDFs incrementally in volume? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-load-pdfs-incrementally-in-volume/m-p/163522#M55145</link>
    <description>&lt;P&gt;You can use the Google Drive &lt;STRONG&gt;Managed&lt;/STRONG&gt; connector that does most of it primarily built for syncing structured data directly to Delta Tables or the &lt;STRONG&gt;Standard&lt;/STRONG&gt; connector that allows you to use Databricks (SQL, Auto Loader, pipelines) directly against a Google Drive URL using Unity Catalog connection.&lt;/P&gt;&lt;P&gt;You can follow below&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;U&gt;Incremental Standard Connector&lt;/U&gt; - &lt;/STRONG&gt;&lt;/STRONG&gt;You can use&amp;nbsp;Lakeflow Connect Standard connector with Databricks SQL or Spark Structured Streaming and incrementally ingest the raw bytes of new PDFs directly into a Streaming Table. This bypasses the Unity Catalog Volume entirely and provides the exact incremental tracking you get with COPY INTO. You can parse the newly ingested binaries in a downstream materialized view or streaming table using AI functions. More details &lt;A href="https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/google-drive-pipeline?language=Databricks%C2%A0notebook#ingest-files-as-binary-unstructured" target="_self"&gt;here&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;-- Read raw PDFs incrementally
CREATE OR REFRESH STREAMING TABLE raw AS
SELECT * 
FROM STREAM read_files(
  'gdrive',
  `databricks.connection` =&amp;gt; 'drive_conn',
  format =&amp;gt; 'binaryFile',
  pathGlobFilter =&amp;gt; '*.pdf'
);​

CREATE OR REFRESH MATERIALIZED VIEW parsed_pdf AS 
SELECT 
  path,
  modificationTime,
  ai_parse_document(content) AS parsed_data
FROM raw;&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;U&gt;Incremental Managed Connector&lt;/U&gt;&lt;/STRONG&gt; -&amp;nbsp;&lt;/STRONG&gt;You can use Managed connector with binaryFile ingestion option in Lakeflow Connect to process. More details &lt;A href="https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/google-drive-pipeline?language=Databricks%C2%A0notebook#ingest-files-as-binary-unstructured" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Auto Loader to Staging Volume&lt;/U&gt; - &lt;/STRONG&gt;You can use Pyspark if you have a strict architectural requirement that the pdf files must stay inside a Unity Catalog Volume. You can combine the Lakeflow Connect Standard connector (via Auto Loader) with a PySpark foreachBatch operation. Auto Loader tracks which files in Google Drive are new, and standard Python file operations write the bytes out to the Volume.&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;def save_pdf_to_volume(row):
    import os
    # Extract filename from the Google Drive path
    file_name = os.path.basename(row.path)
    volume_path = f"/Volumes/my_volume/raw_pdfs/{file_name}"
    
    # Write the binary content to the Volume FUSE mount
    with open(volume_path, "wb") as f:
        f.write(row.content)

def process_batch(df, epoch_id):
    df.foreach(save_pdf_to_volume)

# 1. Use Auto Loader (cloudFiles) with the Lakeflow Google Drive connection
df = (spark.readStream
  .format("cloudFiles")
  .option("cloudFiles.format", "binaryFile")
  .option("databricks.connection", "gdrive_conn")
  .option("pathGlobFilter", "*.pdf")
  .load("gdrive")
)

# 2. Write each new file to the Volume and track state via checkpoint
(df.writeStream
  .foreachBatch(process_batch)
  .option("checkpointLocation", "/Volumes//my_volume/_checkpoints/pdf_ingest")
  .start()
)​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jul 2026 14:30:57 GMT</pubDate>
    <dc:creator>balajij8</dc:creator>
    <dc:date>2026-07-20T14:30:57Z</dc:date>
    <item>
      <title>How to load PDFs incrementally in volume?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-load-pdfs-incrementally-in-volume/m-p/163503#M55141</link>
      <description>&lt;P class=""&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm building an Intelligent Document Processing pipeline using Databricks AI Functions (ai_parse_document and ai_extract).&lt;/P&gt;&lt;P&gt;I want to ingest PDF files from a Google Drive folder into a Unity Catalog Volume. I can perform a full load successfully using the Google Drive connector, but I haven't found a way to incrementally load only new or modified PDF files into the Volume.&lt;/P&gt;&lt;P&gt;For structured files like CSV, COPY INTO supports incremental ingestion by tracking previously loaded files. However, I couldn't find an equivalent approach for PDF files when the destination is a Unity Catalog Volume.&lt;BR /&gt;&lt;BR /&gt;does anyone have some workaround for it?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2026 12:33:45 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-load-pdfs-incrementally-in-volume/m-p/163503#M55141</guid>
      <dc:creator>Niyojit</dc:creator>
      <dc:date>2026-07-20T12:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to load PDFs incrementally in volume?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-load-pdfs-incrementally-in-volume/m-p/163522#M55145</link>
      <description>&lt;P&gt;You can use the Google Drive &lt;STRONG&gt;Managed&lt;/STRONG&gt; connector that does most of it primarily built for syncing structured data directly to Delta Tables or the &lt;STRONG&gt;Standard&lt;/STRONG&gt; connector that allows you to use Databricks (SQL, Auto Loader, pipelines) directly against a Google Drive URL using Unity Catalog connection.&lt;/P&gt;&lt;P&gt;You can follow below&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;U&gt;Incremental Standard Connector&lt;/U&gt; - &lt;/STRONG&gt;&lt;/STRONG&gt;You can use&amp;nbsp;Lakeflow Connect Standard connector with Databricks SQL or Spark Structured Streaming and incrementally ingest the raw bytes of new PDFs directly into a Streaming Table. This bypasses the Unity Catalog Volume entirely and provides the exact incremental tracking you get with COPY INTO. You can parse the newly ingested binaries in a downstream materialized view or streaming table using AI functions. More details &lt;A href="https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/google-drive-pipeline?language=Databricks%C2%A0notebook#ingest-files-as-binary-unstructured" target="_self"&gt;here&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;-- Read raw PDFs incrementally
CREATE OR REFRESH STREAMING TABLE raw AS
SELECT * 
FROM STREAM read_files(
  'gdrive',
  `databricks.connection` =&amp;gt; 'drive_conn',
  format =&amp;gt; 'binaryFile',
  pathGlobFilter =&amp;gt; '*.pdf'
);​

CREATE OR REFRESH MATERIALIZED VIEW parsed_pdf AS 
SELECT 
  path,
  modificationTime,
  ai_parse_document(content) AS parsed_data
FROM raw;&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;U&gt;Incremental Managed Connector&lt;/U&gt;&lt;/STRONG&gt; -&amp;nbsp;&lt;/STRONG&gt;You can use Managed connector with binaryFile ingestion option in Lakeflow Connect to process. More details &lt;A href="https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/google-drive-pipeline?language=Databricks%C2%A0notebook#ingest-files-as-binary-unstructured" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;U&gt;Auto Loader to Staging Volume&lt;/U&gt; - &lt;/STRONG&gt;You can use Pyspark if you have a strict architectural requirement that the pdf files must stay inside a Unity Catalog Volume. You can combine the Lakeflow Connect Standard connector (via Auto Loader) with a PySpark foreachBatch operation. Auto Loader tracks which files in Google Drive are new, and standard Python file operations write the bytes out to the Volume.&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="python"&gt;def save_pdf_to_volume(row):
    import os
    # Extract filename from the Google Drive path
    file_name = os.path.basename(row.path)
    volume_path = f"/Volumes/my_volume/raw_pdfs/{file_name}"
    
    # Write the binary content to the Volume FUSE mount
    with open(volume_path, "wb") as f:
        f.write(row.content)

def process_batch(df, epoch_id):
    df.foreach(save_pdf_to_volume)

# 1. Use Auto Loader (cloudFiles) with the Lakeflow Google Drive connection
df = (spark.readStream
  .format("cloudFiles")
  .option("cloudFiles.format", "binaryFile")
  .option("databricks.connection", "gdrive_conn")
  .option("pathGlobFilter", "*.pdf")
  .load("gdrive")
)

# 2. Write each new file to the Volume and track state via checkpoint
(df.writeStream
  .foreachBatch(process_batch)
  .option("checkpointLocation", "/Volumes//my_volume/_checkpoints/pdf_ingest")
  .start()
)​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jul 2026 14:30:57 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-load-pdfs-incrementally-in-volume/m-p/163522#M55145</guid>
      <dc:creator>balajij8</dc:creator>
      <dc:date>2026-07-20T14:30:57Z</dc:date>
    </item>
  </channel>
</rss>

