Local Processing and Zero Data Retention
When you run Local Processing with on Snowflake, your files are not sent outside of your Snowflake environment. Therefore, using Local Processing with maintains zero data retention (ZDR). For detailed information, go to Zero Data Retention (ZDR) Option Overview.Local Processing and Billing
When you use Local Processing, all billing is managed by Snowflake. You do not need to create a separate account with LandingAI.Rate Limits for Local Processing
Local Processing can parse up to 20 pages per minute.Extracted Output
The output from Cloud Processing matches the response you get when calling the API directly. For complete details on the response format, go to API Reference.Quickstart: Local Processing
- Grant permissions to the stage with the files you want to parse.
- Grant permissions to access Cortex.
- Run the parse commands.
- If you want to run field extraction, include the JSON schema in the parse command.
Parse with Local Processing
The app provides this function to run Local Processing:doc_extraction.snowflake_extract_doc_structure
function in different scenarios.
Parse a Single File
Run the command below to parse a single file in a Snowflake stage. Replace these placeholders with your information:APP_NAME
, your_db
, your_schema
, your_stage
, and /path/to/file.pdf
.
Sample Script: Parse a Single File
Let’s say you have the following setup:- APP_NAME: LANDINGAI_AGENTIC_DOCUMENT_EXTRACTION
- Database: DEMO_DB
- Schema: DEMO_SCHEMA
- Stage: DEMO_STAGE
- statement-jane-harper.pdf

Parse a Batch of Files in a Table
One way to process multiple documents is to create a table that lists the filenames of documents stored in a Snowflake stage. Then, write a SQL script that processes each file by using the file paths from the table. This approach uses the concatenation operator (||
) to connect the file paths in your table to the actual documents in your stage.
Use the following script to process multiple files from a table. Replace these placeholders with your information: APP_NAME
, your_db
, your_schema
, your_stage
, and documents
. The script assumes you have a table called documents that has a column called file_path
, which lists the filenames of the documents you want to process.
Sample Script: Parse a Batch of Files in a Table
Let’s say you have the following setup:- APP_NAME: LANDINGAI_AGENTIC_DOCUMENT_EXTRACTION
- Database: DEMO_DB
- Schema: DEMO_SCHEMA
- Stage: DEMO_STAGE (contains PDFs)
- Table: STATEMENTS
file_path
. The file_path
column contains the following the following filenames:
- document-1.pdf
- document-2.pdf
- document-3.pdf

Parse a Batch of Files in a Fixed List
One way to process multiple documents is to specify the exact filenames directly in your SQL script. This approach is useful when you know exactly which files you want to process and don’t need to create a separate table. This method creates a temporary list of filenames within the SQL query itself and processes each file from your Snowflake stage. Use the following script to process multiple files from a fixed list. Replace these placeholders with your information:APP_NAME
, your_db
, your_schema
, your_stage
, and the file paths in the VALUES section. Make sure to include the forward slash (/
) before each filename.
Sample Script: Parse a Batch of Files in a Fixed List
Let’s say you have the following setup: This example processes three specific PDF files stored in a stage called DEMO_STAGE.- APP_NAME: LANDINGAI_AGENTIC_DOCUMENT_EXTRACTION
- Database: DEMO_DB
- Schema: DEMO_SCHEMA
- Stage: DEMO_STAGE
- statement-george-mathew.png
- statement-jane-harper.pdf
- statement-john-doe.png

Field Extraction
The app on Snowflake supports field extraction, which allows you to extract specific key:value pairs from the documents you are parsing. The key:value pairs are defined using an extraction schema. Learn more about field extraction in Overview: Extract Data. To run field extraction, add the field extraction schema as a parameter in thedoc_extraction.snowflake_extract_doc_structure
function.
Schema Structure for Local Processing
Snowflake requires specific JSON schema formatting that may differ from schemas you’ve used directly in or Cloud Processing. When performing field extraction with Local Processing, your JSON schema must include these required elements:"additionalProperties": false
: Prevents the extraction of fields not defined in the schema."required": ["field1", "field2"]
: Specifies which fields are mandatory.
For complete JSON schema specifications and additional formatting requirements, see the Snowflake documentation.
Sample Script: Run Field Extraction on Single File
Let’s say you have the following setup:- APP_NAME: LANDINGAI_AGENTIC_DOCUMENT_EXTRACTION
- Database: DEMO_DB
- Schema: DEMO_SCHEMA
- Stage: DEMO_STAGE
- statement-jane-harper.pdf
- Employee Name
- Employee Social Security Number