# Getting started

## System requirements

* Python 3.9+
* [Snowflake Connector Python](https://docs.snowflake.com/en/user-guide/python-connector-install.html)
* [PyYAML](https://github.com/yaml/pyyaml)
* [JSONSchema](https://github.com/Julian/jsonschema)

## Hand-on example

It will take about 10 minutes.

1\) Install SnowDDL.

```
pip install snowddl
```

2\) Create a new [Snowflake Trial Account](https://signup.snowflake.com/) or create a [new account within your organization](https://docs.snowflake.com/en/sql-reference/sql/create-account.html).

{% hint style="warning" %}
Do NOT use existing production account with real data to test object management tools.
{% endhint %}

3\) [Generate private and public key](https://docs.snowflake.com/en/user-guide/key-pair-auth#configuring-key-pair-authentication) for key-pair authentication of SnowDDL administrator user.

{% hint style="info" %}
It is still possible to use single-factor PASSWORD authentication for testing purpose, but it is NOT recommended due to updated Snowflake security guidelines:

<https://www.snowflake.com/en/blog/blocking-single-factor-password-authentification/>
{% endhint %}

4\) Create administration user for SnowDDL. Replace `RSA_PUBLIC_KEY` with contents of generated public key. It should look like a single line without header & footer and without line-breaks.

```sql
USE ROLE ACCOUNTADMIN;

CREATE ROLE SNOWDDL_ADMIN;

GRANT ROLE SYSADMIN TO ROLE SNOWDDL_ADMIN;
GRANT ROLE SECURITYADMIN TO ROLE SNOWDDL_ADMIN;

CREATE USER SNOWDDL
TYPE = SERVICE
RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...'
DEFAULT_ROLE = SNOWDDL_ADMIN;

GRANT ROLE SNOWDDL_ADMIN TO USER SNOWDDL;
GRANT ROLE SNOWDDL_ADMIN TO ROLE ACCOUNTADMIN;
```

5\) Apply [first version](https://github.com/littleK0i/snowddl/tree/master/snowddl/_config/sample01_01) of sample config (provided with SnowDDL installation). Replace `<account_identifier>` placeholder with Snowflake [account identifier](https://docs.snowflake.com/en/user-guide/admin-account-identifier.html). Replace `<path_to_private_key>` with path to private key file generated in step 3.

```
snowddl \
-c sample01_01 \
-a <account_identifier> \
-u snowddl \
-k <path_to_private_key> \
--apply-unsafe \
apply
```

Check database `SNOWDDL_DB` in Snowflake account. Check list of warehouses and roles.

6\) Apply [second version](https://github.com/littleK0i/snowddl/tree/master/snowddl/_config/sample01_02) of sample config (provided with SnowDDL installation).

```
snowddl \
-c sample01_02 \
-a <account_identifier> \
-u snowddl \
-k <path_to_private_key> \
--apply-unsafe \
apply
```

Check logs. Some objects will be altered, some objects will be dropped.

7\) Reset Snowflake account to the original state. All objects created earlier by SnowDDL will be dropped.

```
snowddl \
-c sample01_02 \
-a <account_identifier> \
-u snowddl \
-k <path_to_private_key> \
--apply-unsafe \
--destroy-without-prefix \
destroy
```

### Congratulations!

Now you are ready to create your own config and start experimenting.

<br>


---

# 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/getting-started.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.
