# STAGE FILE

Stage files are used primarily to maintain packages (e.g. JAR files) for Snowpark functions.

You may put any directories or files in `/<database>/<schema>/stage/<stage_name>/*`

SnowDDL will synchronise files with internal stage automatically.

Example: [GitHub link](https://github.com/littleK0i/SnowDDL/tree/master/snowddl/_config/sample02_01/test_db/test_schema/stage/test_internal_stage) (`test_internal_stage`).

## Usage notes

1. Pre-compiled JAR files for popular libraries can be downloaded directly from [MVN repository](https://mvnrepository.com/).
2. Directory structure is maintained.
3. It is recommended to have multiple small files VS. one large file. Each file is uploaded individually in a separate thread.
4. For each stage file SnowDDL puts an additional empty technical file. It is used to compare local version of file on disk with remote version of file in stage. Technical file is named `<original_name>.<md5_hash>.md5`. Unfortunately, it is not possible to use `md5` provided by Snowflake `LIST` command, since files in internal stages seems to be encrypted or modified in some other way.

## Links

* [PUT](https://docs.snowflake.com/en/sql-reference/sql/put.html)
* [LIST](https://docs.snowflake.com/en/sql-reference/sql/list.html)
* [REMOVE](https://docs.snowflake.com/en/sql-reference/sql/remove.html)
* [Parser & JSON Schema (GitHub)](https://github.com/littleK0i/SnowDDL/blob/master/snowddl/parser/stage.py)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.snowddl.com/basic/yaml-configs/stage-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
