Metadata-Version: 2.4
Name: snowflake-semantic-tools
Version: 0.1.0
Summary: dbt extension for managing Snowflake Semantic Views and Cortex Analyst semantic models
License: Apache-2.0
License-File: LICENSE
Keywords: snowflake,dbt,semantic-layer
Author: Matt Luizzi
Author-email: matthew.luizzi@whoop.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: click (==8.1.7)
Requires-Dist: numpy (==1.24.0)
Requires-Dist: packaging (==24.2)
Requires-Dist: python-dotenv (==1.0.1)
Requires-Dist: pyyaml (==6.0.2)
Requires-Dist: rich (==13.9.4)
Requires-Dist: ruamel-yaml (==0.18.6)
Requires-Dist: snowflake-connector-python[pandas,secure-local-storage] (==3.12.3)
Requires-Dist: tqdm (==4.67.1)
Requires-Dist: typing-extensions (==4.12.2)
Project-URL: Homepage, https://github.com/WhoopInc/snowflake-semantic-tools
Project-URL: Repository, https://github.com/WhoopInc/snowflake-semantic-tools
Description-Content-Type: text/markdown

# Snowflake Semantic Tools

dbt extension for managing Snowflake Semantic Views and Cortex Analyst semantic models

[![Python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)

---

## What is SST?

SST integrates Snowflake's semantic layer into your dbt workflow. Define semantic views, metrics, and relationships in YAML alongside your dbt models, then deploy them as native Snowflake SEMANTIC VIEW objects.

**What you can do:**

- **Define semantics in dbt** - Metrics, relationships, filters as YAML in your dbt project
- **Deploy to Snowflake** - Create SEMANTIC VIEW objects for Cortex Analyst and BI tools
- **Enrich metadata** - Auto-populate YAML from Snowflake table schemas
- **Validate before deploy** - Catch errors without Snowflake connection
- **Maintain as code** - Version control your semantic layer with dbt

---

## Quick Start

### Installation

```bash
pip install snowflake-semantic-tools
```

### Basic Usage

```bash
# Validate your semantic models
sst validate

# Enrich dbt models with metadata from Snowflake
sst enrich models/ --database PROD_DB --schema my_schema

# Deploy to Snowflake (validate → extract → generate)
sst deploy --db PROD_DB --schema SEMANTIC_VIEWS
```

---

## Key Features

- **Metadata Enrichment** - Auto-populate YAML with column types, samples, and enums
- **Validation** - Catch errors before deployment (no Snowflake connection needed)
- **Semantic Views** - Generate native Snowflake SEMANTIC VIEWs
- **Defer Database** - Generate dev views that reference prod tables (like dbt defer)
- **YAML Linter** - Consistent formatting across your project
- **Python API** - Full programmatic access to all features

---

## Documentation

See the `docs/` directory for comprehensive documentation:

- [**Getting Started**](docs/getting-started.md) - Installation and first steps
- [**Validation Checklist**](docs/validation-checklist.md) - Complete list of all 98 validation checks
- [**CLI Reference**](docs/cli-reference.md) - All commands and options
- [**User Guide**](docs/user-guide.md) - Enrichment and validation deep dives
- [**Semantic Models Guide**](docs/semantic-models-guide.md) - Writing metrics and relationships
- [**Authentication**](docs/authentication.md) - Snowflake connection setup

---

## Requirements

- Python 3.9+
- Snowflake account
- dbt project with YAML definitions

---

## Commands

| Command | Purpose |
|---------|---------|
| `sst validate` | Check for errors (no Snowflake needed) |
| `sst enrich` | Add metadata to YAML from Snowflake |
| `sst format` | YAML linter for consistency |
| `sst extract` | Load metadata to Snowflake tables |
| `sst generate` | Create semantic views |
| `sst deploy` | One-step: validate → extract → generate |

---

## Installation

**For users (recommended):**

```bash
pip install snowflake-semantic-tools
```

**For developers/contributors:**

If you want to contribute or modify the code, see the [Development Setup](#development-setup) section below or [CONTRIBUTING.md](CONTRIBUTING.md) for detailed instructions.

## Development Setup

**Only needed if you're contributing code or developing locally.**

```bash
# Clone the repository
git clone https://github.com/WhoopInc/snowflake-semantic-tools.git
cd snowflake-semantic-tools

# Install with Poetry (includes dev dependencies)
poetry install --with dev

# Verify installation
sst --version

# Run tests
pytest tests/unit/

# Format code
black snowflake_semantic_tools/
isort snowflake_semantic_tools/

# Run linting
flake8 snowflake_semantic_tools/
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed development guidelines.

---

## Contributing

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for:
- How to report issues
- Development setup instructions
- Code style guidelines
- Pull request process

**All contributions must be reviewed by the maintainer before merging.**

---

## Support

- **Documentation**: See the [docs/](docs/) directory
- **Issues**: [GitHub Issues](https://github.com/WhoopInc/snowflake-semantic-tools/issues)

---

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

