# YAML placeholders

SnowDDL supports placeholders in YAML configs. Placeholder format is similar to GitHub Actions:

```yaml
${{ <placeholder> }}
```

Examples:

```yaml
my_warehouse:
  size: ${{ wh_size }}
  auto_suspend: ${{ wh_auto_suspend }}
```

```yaml
url: s3://${{ bucket_name }}/my_path/
storage_integration: test_storage_integration
file_format: test_avro_format
```

## Configuration

Placeholders should be defined in config path: `/placeholder.yaml`

Example:

```yaml
wh_size: SMALL
wh_auto_suspend: 300
bucket_name: dev-test-bucket
```

Additionally, you may specify a path to file with environment-specific placeholder values. For example, you may use it to override `bucket_name` from `dev-test-bucket` in DEV environment to `prod-test-bucket` in PROD environment.

```yaml
bucket_name: prod-test-bucket
```

CLI option is `--placeholder-path` :

```
snowddl \
-c <config> \
-a <account_identifier> \
-u <user> \
-p <password> \
--placeholder-path=<path_to_custom_placeholder.yaml>
apply
```

## Placeholders from command line argument

Alternatively, it is possible to specify custom placeholder values using CLI argument `--placeholder-values`. This argument accepts JSON string. For example:

```
snowddl \
-c <config> \
-a <account_identifier> \
-u <user> \
-p <password> \
--placeholder-values="{\"bucket_name\": \"prod-test-bucket\"}"
apply
```

Data types of JSON values are important!

For example, placeholders for BOOLEAN values should be specified as JSON `true` or `false` without quotes. Numeric values should not have quotes as well.

## Technical placeholders

A small number of placeholders are created automatically and always available. These placeholders can still be overloaded by config if necessary.

* **env\_prefix** (str) - contains current [env prefix](/guides/other-guides/env-prefix.md) value. For example, if env prefix is `ALICE`, this placeholder will contain `ALICE__`. It should be used as a part of raw SQL fragments when it is necessary to access object in another database. It is especially useful for [VIEW](/basic/yaml-configs/view.md) definitions.\
  \
  For example: `${{ env_prefix }}db_name.schema_name.object_name`.<br>
* **target\_db** (str) - contains target database name in [SingleDB mode](/single-db/overview.md), including env prefix. Requires `--target-db` CLI argument to be set explicitly.

## Usage notes

1. Data types of placeholder values are preserved. You may use integers, booleans, floats, etc.
2. All placeholders should be defined explicitly. Undefined placeholders will raise an exception and stop further execution to prevent an accidental damage.


---

# 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-placeholders.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.
