sqlfluff-templater-schemachange


Namesqlfluff-templater-schemachange JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA standalone SQLFluff templater providing schemachange-compatible Jinja templating without schemachange dependency
upload_time2025-08-04 06:43:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords sqlfluff templater schemachange snowflake database linting
VCS
bugtrack_url
requirements black flake8 mypy pytest pytest-cov PyYAML sqlfluff
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SQLFluff Templater for Schemachange

A custom SQLFluff templater that provides **schemachange-compatible** Jinja templating features. This templater reads `schemachange-config.yml` files and provides the same templating experience as schemachange without requiring schemachange as a dependency.

> **Note**: This is a **standalone implementation** that replicates schemachange's templating behavior within SQLFluff. It does **not** import or depend on the schemachange package itself.

## Features

- **Schemachange-Compatible Config**: Reads `schemachange-config.yml` files using the same format and structure
- **Jinja2 Templating**: Full SQLFluff JinjaTemplater support with additional schemachange-style functions
- **Variable Management**: Supports complex nested variables exactly like schemachange
- **Environment Variables**: Provides `env_var()` function matching schemachange's implementation
- **Modules Support**: Load templates and macros from folders (schemachange `modules-folder` equivalent)
- **No External Dependencies**: Pure SQLFluff + PyYAML implementation, no schemachange package required

## Why Use This?

This templater is ideal when you want to:
- **Lint schemachange SQL files** with SQLFluff's comprehensive rule set
- **Use existing schemachange configs** without installing the full schemachange toolchain
- **Integrate SQL linting** into CI/CD pipelines that use schemachange for deployments
- **Maintain consistency** between your schemachange templates and SQLFluff linting

The templater replicates schemachange's Jinja environment and config parsing, so your templates work identically in both tools.

## Installation

```bash
pip install sqlfluff-templater-schemachange
```

Or install from source:

```bash
git clone https://github.com/MACKAT05/sqlfluff-templater-schemachange
cd sqlfluff-templater-schemachange
pip install -e .
```

## Configuration

### Basic SQLFluff Configuration

Create a `.sqlfluff` file in your project root:

```ini
[sqlfluff]
templater = schemachange
dialect = snowflake

[sqlfluff:templater:schemachange]
# Path to schemachange config folder (optional, defaults to '.')
config_folder = .

# Schemachange config file name (optional, defaults to 'schemachange-config.yml')
config_file = schemachange-config.yml

# Modules folder for macro loading (optional)
modules_folder = modules

# Additional variables (merged with config file vars)
vars = {"environment": "dev", "schema_suffix": "_DEV"}
```

### Schemachange Configuration

Create a `schemachange-config.yml` file:

```yaml
config-version: 1

# Basic schemachange settings
root-folder: 'scripts'
modules-folder: 'modules'

# Database connection settings
snowflake-account: '{{ env_var("SNOWFLAKE_ACCOUNT") }}'
snowflake-user: '{{ env_var("SNOWFLAKE_USER") }}'
snowflake-role: 'TRANSFORMER'
snowflake-warehouse: 'COMPUTE_WH'
snowflake-database: 'MY_DATABASE'

# Variables for templating
vars:
  database_name: 'MY_DATABASE'
  schema_name: 'ANALYTICS'
  environment: 'production'
  table_prefix: 'fact_'

  # Nested variables
  sources:
    raw_database: 'RAW_DATA'
    staging_database: 'STAGING'

  # Secret variables (automatically filtered from logs)
  secrets:
    api_key: '{{ env_var("API_KEY") }}'
    encryption_key: '{{ env_var("ENCRYPTION_KEY") }}'

# Additional settings
create-change-history-table: false
autocommit: false
verbose: true
```

## Usage Examples

### Basic Variable Templating

**SQL File** (`V1.0.1__create_tables.sql`):
```sql
-- Create tables with dynamic names
CREATE TABLE {{ database_name }}.{{ schema_name }}.{{ table_prefix }}sales (
    id INTEGER,
    customer_id INTEGER,
    amount DECIMAL(10,2),
    created_at TIMESTAMP
);

CREATE TABLE {{ database_name }}.{{ schema_name }}.{{ table_prefix }}customers (
    id INTEGER,
    name VARCHAR(255),
    email VARCHAR(255)
);
```

### Using Nested Variables

```sql
-- Reference nested configuration
CREATE SCHEMA IF NOT EXISTS {{ sources.staging_database }}.INTERMEDIATE;

-- Copy data from raw to staging
CREATE TABLE {{ sources.staging_database }}.INTERMEDIATE.cleaned_data AS
SELECT * FROM {{ sources.raw_database }}.PUBLIC.raw_data
WHERE created_at >= '{{ start_date }}';
```



### Using Jinja Macros

**Macro file** (`modules/common_macros.sql`):
```sql
{% macro create_audit_columns() %}
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    created_by VARCHAR(255) DEFAULT CURRENT_USER()
{% endmacro %}

{% macro generate_schema_name(custom_schema_name=none, node=none) %}
    {% if custom_schema_name is none %}
        {{ target.schema }}
    {% else %}
        {{ target.schema }}_{{ custom_schema_name | trim }}
    {% endif %}
{% endmacro %}
```

**SQL file using macros**:
```sql
CREATE TABLE {{ database_name }}.{{ generate_schema_name('analytics') }}.user_events (
    event_id INTEGER,
    user_id INTEGER,
    event_type VARCHAR(50),
    {{ create_audit_columns() }}
);
```

### Environment Variable Integration

Access environment variables using the `env_var()` function:

```sql
-- Use environment variables with defaults
USE WAREHOUSE {{ env_var('SNOWFLAKE_WAREHOUSE', 'DEFAULT_WH') }};
USE DATABASE {{ env_var('DATABASE_NAME', database_name) }};

-- Connect to environment-specific database
USE DATABASE {{ database_name }}_{{ env_var('ENVIRONMENT', 'dev') | upper }};

-- Use secrets from environment
CREATE OR REPLACE EXTERNAL FUNCTION get_data(...)
RETURNS VARIANT
LANGUAGE PYTHON
HANDLER='main'
API_INTEGRATION = {{ env_var('API_INTEGRATION_NAME') }};
```

### Conditional Logic

```sql
CREATE TABLE {{ database_name }}.{{ schema_name }}.events (
    event_id INTEGER,
    user_id INTEGER,
    event_data JSON,

    {% if environment == 'production' %}
    -- Only add PII columns in production
    user_email VARCHAR(255),
    user_phone VARCHAR(20),
    {% endif %}

    created_at TIMESTAMP
);

{% if environment != 'production' %}
-- Add test data in non-production environments
INSERT INTO {{ database_name }}.{{ schema_name }}.events
VALUES (1, 100, '{"test": true}', CURRENT_TIMESTAMP);
{% endif %}
```

### Template Inheritance

**Base template** (`modules/base_table.sql`):
```sql
{% block table_definition %}
CREATE TABLE {{ database_name }}.{{ schema_name }}.{{ table_name }} (
    {% block columns %}{% endblock %}
    {% block audit_columns %}
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    {% endblock %}
);
{% endblock %}

{% block post_create %}
-- Default post-creation steps
{% endblock %}
```

**Specific table** (`V1.0.2__create_products.sql`):
```sql
{% extends "base_table.sql" %}
{% set table_name = "products" %}

{% block columns %}
    product_id INTEGER PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    price DECIMAL(10,2),
    category VARCHAR(100),
{% endblock %}

{% block post_create %}
-- Add specific indexes
CREATE INDEX idx_products_category ON {{ database_name }}.{{ schema_name }}.{{ table_name }} (category);
{% endblock %}
```

## Running SQLFluff

Once configured, run SQLFluff as usual:

```bash
# Lint all SQL files
sqlfluff lint

# Lint specific files
sqlfluff lint scripts/versioned/

# Fix auto-fixable issues
sqlfluff fix

# Check specific file with verbose output
sqlfluff lint --verbose V1.0.1__create_tables.sql
```

## Advanced Configuration

### Multiple Environment Support

You can have different configurations for different environments:

**.sqlfluff** (development):
```ini
[sqlfluff:templater:schemachange]
config_folder = configs
config_file = dev-config.yml
vars = {"environment": "dev"}
```

**configs/dev-config.yml**:
```yaml
config-version: 1
vars:
  database_name: 'DEV_DATABASE'
  environment: 'dev'
  debug_mode: true
```

**configs/prod-config.yml**:
```yaml
config-version: 1
vars:
  database_name: 'PROD_DATABASE'
  environment: 'prod'
  debug_mode: false
```

### Macro Loading

Configure macro loading from a modules folder:

```ini
[sqlfluff:templater:schemachange]
modules_folder = templates/macros
```

This allows you to use `{% include %}` and `{% import %}` statements to load macros from the specified folder.

### Integration with CI/CD

**GitHub Actions example**:
```yaml
name: SQL Linting
on: [push, pull_request]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.9'

      - name: Install dependencies
        run: |
          pip install sqlfluff sqlfluff-templater-schemachange

      - name: Lint SQL files
        env:
          SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
          SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
        run: |
          sqlfluff lint scripts/
```

## Secret Handling

The templater automatically identifies and filters secrets from logs based on:

1. Variable names containing "secret" (case-insensitive)
2. Variables nested under a "secrets" key

```yaml
vars:
  api_key_secret: "sensitive_value"  # Filtered
  database_password: "password123"   # Not filtered

  secrets:
    oauth_token: "token123"          # Filtered
    encryption_key: "key456"         # Filtered
```

## Troubleshooting

### Common Issues

1. **Template not found**: Ensure your `modules-folder` is correctly configured
2. **Undefined variable**: Check your `schemachange-config.yml` and CLI `vars`
3. **Permission errors**: Verify file paths and permissions for config and template files

### Debug Mode

Enable verbose logging to see what's happening:

```bash
sqlfluff lint --verbose --debug
```

### Environment Variables

Use environment variables for sensitive configuration:

```bash
export SNOWFLAKE_ACCOUNT="your-account"
export SNOWFLAKE_USER="your-user"
sqlfluff lint
```

## Contributing

### Development Setup

The project uses static tests for easy debugging and CI integration:

```bash
# Clone the repository
git clone https://github.com/MACKAT05/sqlfluff-templater-schemachange
cd sqlfluff-templater-schemachange

# Install in development mode
pip install -e .

# Install development dependencies
pip install -r requirements.txt

# Install pre-commit
pip install pre-commit
pre-commit install
```

The project includes static test files in the `tests/` directory for easy debugging and CI integration.

### Testing

The project includes static test files for easy debugging:

```bash
# Run all tests
python tests/run_tests.py

# Run individual tests
python tests/test_basic.py
python tests/test_modules.py
python tests/test_env_vars.py
python tests/test_conditional.py
```

### Development Workflow

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Test your changes:
   ```bash
   # Run all tests
   python tests/run_tests.py

   # Test SQLFluff integration
   cd tests/basic && sqlfluff render test.sql
   ```
5. Pre-commit hooks will run automatically on `git commit`
6. Submit a pull request

### Note on Pre-commit

The pre-commit configuration uses local SQLFluff hooks that require the development package to be installed first. This avoids the chicken-and-egg problem of trying to install the package from PyPI before it's published.

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Related Projects

- [SQLFluff](https://github.com/sqlfluff/sqlfluff) - The SQL linter this plugin extends
- [schemachange](https://github.com/Snowflake-Labs/schemachange) - Database change management tool this integrates with
- [Snowflake](https://www.snowflake.com/) - Cloud data platform

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sqlfluff-templater-schemachange",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Thomas MacKay <mackay.thomas@gmail.com>",
    "keywords": "sqlfluff, templater, schemachange, snowflake, database, linting",
    "author": null,
    "author_email": "Thomas MacKay <mackay.thomas@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f1/37/56275c43fc7d37c10ed73efeb527d6a162862e2708885263c1d966d89170/sqlfluff_templater_schemachange-0.1.0.tar.gz",
    "platform": null,
    "description": "# SQLFluff Templater for Schemachange\n\nA custom SQLFluff templater that provides **schemachange-compatible** Jinja templating features. This templater reads `schemachange-config.yml` files and provides the same templating experience as schemachange without requiring schemachange as a dependency.\n\n> **Note**: This is a **standalone implementation** that replicates schemachange's templating behavior within SQLFluff. It does **not** import or depend on the schemachange package itself.\n\n## Features\n\n- **Schemachange-Compatible Config**: Reads `schemachange-config.yml` files using the same format and structure\n- **Jinja2 Templating**: Full SQLFluff JinjaTemplater support with additional schemachange-style functions\n- **Variable Management**: Supports complex nested variables exactly like schemachange\n- **Environment Variables**: Provides `env_var()` function matching schemachange's implementation\n- **Modules Support**: Load templates and macros from folders (schemachange `modules-folder` equivalent)\n- **No External Dependencies**: Pure SQLFluff + PyYAML implementation, no schemachange package required\n\n## Why Use This?\n\nThis templater is ideal when you want to:\n- **Lint schemachange SQL files** with SQLFluff's comprehensive rule set\n- **Use existing schemachange configs** without installing the full schemachange toolchain\n- **Integrate SQL linting** into CI/CD pipelines that use schemachange for deployments\n- **Maintain consistency** between your schemachange templates and SQLFluff linting\n\nThe templater replicates schemachange's Jinja environment and config parsing, so your templates work identically in both tools.\n\n## Installation\n\n```bash\npip install sqlfluff-templater-schemachange\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/MACKAT05/sqlfluff-templater-schemachange\ncd sqlfluff-templater-schemachange\npip install -e .\n```\n\n## Configuration\n\n### Basic SQLFluff Configuration\n\nCreate a `.sqlfluff` file in your project root:\n\n```ini\n[sqlfluff]\ntemplater = schemachange\ndialect = snowflake\n\n[sqlfluff:templater:schemachange]\n# Path to schemachange config folder (optional, defaults to '.')\nconfig_folder = .\n\n# Schemachange config file name (optional, defaults to 'schemachange-config.yml')\nconfig_file = schemachange-config.yml\n\n# Modules folder for macro loading (optional)\nmodules_folder = modules\n\n# Additional variables (merged with config file vars)\nvars = {\"environment\": \"dev\", \"schema_suffix\": \"_DEV\"}\n```\n\n### Schemachange Configuration\n\nCreate a `schemachange-config.yml` file:\n\n```yaml\nconfig-version: 1\n\n# Basic schemachange settings\nroot-folder: 'scripts'\nmodules-folder: 'modules'\n\n# Database connection settings\nsnowflake-account: '{{ env_var(\"SNOWFLAKE_ACCOUNT\") }}'\nsnowflake-user: '{{ env_var(\"SNOWFLAKE_USER\") }}'\nsnowflake-role: 'TRANSFORMER'\nsnowflake-warehouse: 'COMPUTE_WH'\nsnowflake-database: 'MY_DATABASE'\n\n# Variables for templating\nvars:\n  database_name: 'MY_DATABASE'\n  schema_name: 'ANALYTICS'\n  environment: 'production'\n  table_prefix: 'fact_'\n\n  # Nested variables\n  sources:\n    raw_database: 'RAW_DATA'\n    staging_database: 'STAGING'\n\n  # Secret variables (automatically filtered from logs)\n  secrets:\n    api_key: '{{ env_var(\"API_KEY\") }}'\n    encryption_key: '{{ env_var(\"ENCRYPTION_KEY\") }}'\n\n# Additional settings\ncreate-change-history-table: false\nautocommit: false\nverbose: true\n```\n\n## Usage Examples\n\n### Basic Variable Templating\n\n**SQL File** (`V1.0.1__create_tables.sql`):\n```sql\n-- Create tables with dynamic names\nCREATE TABLE {{ database_name }}.{{ schema_name }}.{{ table_prefix }}sales (\n    id INTEGER,\n    customer_id INTEGER,\n    amount DECIMAL(10,2),\n    created_at TIMESTAMP\n);\n\nCREATE TABLE {{ database_name }}.{{ schema_name }}.{{ table_prefix }}customers (\n    id INTEGER,\n    name VARCHAR(255),\n    email VARCHAR(255)\n);\n```\n\n### Using Nested Variables\n\n```sql\n-- Reference nested configuration\nCREATE SCHEMA IF NOT EXISTS {{ sources.staging_database }}.INTERMEDIATE;\n\n-- Copy data from raw to staging\nCREATE TABLE {{ sources.staging_database }}.INTERMEDIATE.cleaned_data AS\nSELECT * FROM {{ sources.raw_database }}.PUBLIC.raw_data\nWHERE created_at >= '{{ start_date }}';\n```\n\n\n\n### Using Jinja Macros\n\n**Macro file** (`modules/common_macros.sql`):\n```sql\n{% macro create_audit_columns() %}\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    created_by VARCHAR(255) DEFAULT CURRENT_USER()\n{% endmacro %}\n\n{% macro generate_schema_name(custom_schema_name=none, node=none) %}\n    {% if custom_schema_name is none %}\n        {{ target.schema }}\n    {% else %}\n        {{ target.schema }}_{{ custom_schema_name | trim }}\n    {% endif %}\n{% endmacro %}\n```\n\n**SQL file using macros**:\n```sql\nCREATE TABLE {{ database_name }}.{{ generate_schema_name('analytics') }}.user_events (\n    event_id INTEGER,\n    user_id INTEGER,\n    event_type VARCHAR(50),\n    {{ create_audit_columns() }}\n);\n```\n\n### Environment Variable Integration\n\nAccess environment variables using the `env_var()` function:\n\n```sql\n-- Use environment variables with defaults\nUSE WAREHOUSE {{ env_var('SNOWFLAKE_WAREHOUSE', 'DEFAULT_WH') }};\nUSE DATABASE {{ env_var('DATABASE_NAME', database_name) }};\n\n-- Connect to environment-specific database\nUSE DATABASE {{ database_name }}_{{ env_var('ENVIRONMENT', 'dev') | upper }};\n\n-- Use secrets from environment\nCREATE OR REPLACE EXTERNAL FUNCTION get_data(...)\nRETURNS VARIANT\nLANGUAGE PYTHON\nHANDLER='main'\nAPI_INTEGRATION = {{ env_var('API_INTEGRATION_NAME') }};\n```\n\n### Conditional Logic\n\n```sql\nCREATE TABLE {{ database_name }}.{{ schema_name }}.events (\n    event_id INTEGER,\n    user_id INTEGER,\n    event_data JSON,\n\n    {% if environment == 'production' %}\n    -- Only add PII columns in production\n    user_email VARCHAR(255),\n    user_phone VARCHAR(20),\n    {% endif %}\n\n    created_at TIMESTAMP\n);\n\n{% if environment != 'production' %}\n-- Add test data in non-production environments\nINSERT INTO {{ database_name }}.{{ schema_name }}.events\nVALUES (1, 100, '{\"test\": true}', CURRENT_TIMESTAMP);\n{% endif %}\n```\n\n### Template Inheritance\n\n**Base template** (`modules/base_table.sql`):\n```sql\n{% block table_definition %}\nCREATE TABLE {{ database_name }}.{{ schema_name }}.{{ table_name }} (\n    {% block columns %}{% endblock %}\n    {% block audit_columns %}\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n    {% endblock %}\n);\n{% endblock %}\n\n{% block post_create %}\n-- Default post-creation steps\n{% endblock %}\n```\n\n**Specific table** (`V1.0.2__create_products.sql`):\n```sql\n{% extends \"base_table.sql\" %}\n{% set table_name = \"products\" %}\n\n{% block columns %}\n    product_id INTEGER PRIMARY KEY,\n    name VARCHAR(255) NOT NULL,\n    price DECIMAL(10,2),\n    category VARCHAR(100),\n{% endblock %}\n\n{% block post_create %}\n-- Add specific indexes\nCREATE INDEX idx_products_category ON {{ database_name }}.{{ schema_name }}.{{ table_name }} (category);\n{% endblock %}\n```\n\n## Running SQLFluff\n\nOnce configured, run SQLFluff as usual:\n\n```bash\n# Lint all SQL files\nsqlfluff lint\n\n# Lint specific files\nsqlfluff lint scripts/versioned/\n\n# Fix auto-fixable issues\nsqlfluff fix\n\n# Check specific file with verbose output\nsqlfluff lint --verbose V1.0.1__create_tables.sql\n```\n\n## Advanced Configuration\n\n### Multiple Environment Support\n\nYou can have different configurations for different environments:\n\n**.sqlfluff** (development):\n```ini\n[sqlfluff:templater:schemachange]\nconfig_folder = configs\nconfig_file = dev-config.yml\nvars = {\"environment\": \"dev\"}\n```\n\n**configs/dev-config.yml**:\n```yaml\nconfig-version: 1\nvars:\n  database_name: 'DEV_DATABASE'\n  environment: 'dev'\n  debug_mode: true\n```\n\n**configs/prod-config.yml**:\n```yaml\nconfig-version: 1\nvars:\n  database_name: 'PROD_DATABASE'\n  environment: 'prod'\n  debug_mode: false\n```\n\n### Macro Loading\n\nConfigure macro loading from a modules folder:\n\n```ini\n[sqlfluff:templater:schemachange]\nmodules_folder = templates/macros\n```\n\nThis allows you to use `{% include %}` and `{% import %}` statements to load macros from the specified folder.\n\n### Integration with CI/CD\n\n**GitHub Actions example**:\n```yaml\nname: SQL Linting\non: [push, pull_request]\n\njobs:\n  lint:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n\n      - name: Set up Python\n        uses: actions/setup-python@v2\n        with:\n          python-version: '3.9'\n\n      - name: Install dependencies\n        run: |\n          pip install sqlfluff sqlfluff-templater-schemachange\n\n      - name: Lint SQL files\n        env:\n          SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}\n          SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}\n        run: |\n          sqlfluff lint scripts/\n```\n\n## Secret Handling\n\nThe templater automatically identifies and filters secrets from logs based on:\n\n1. Variable names containing \"secret\" (case-insensitive)\n2. Variables nested under a \"secrets\" key\n\n```yaml\nvars:\n  api_key_secret: \"sensitive_value\"  # Filtered\n  database_password: \"password123\"   # Not filtered\n\n  secrets:\n    oauth_token: \"token123\"          # Filtered\n    encryption_key: \"key456\"         # Filtered\n```\n\n## Troubleshooting\n\n### Common Issues\n\n1. **Template not found**: Ensure your `modules-folder` is correctly configured\n2. **Undefined variable**: Check your `schemachange-config.yml` and CLI `vars`\n3. **Permission errors**: Verify file paths and permissions for config and template files\n\n### Debug Mode\n\nEnable verbose logging to see what's happening:\n\n```bash\nsqlfluff lint --verbose --debug\n```\n\n### Environment Variables\n\nUse environment variables for sensitive configuration:\n\n```bash\nexport SNOWFLAKE_ACCOUNT=\"your-account\"\nexport SNOWFLAKE_USER=\"your-user\"\nsqlfluff lint\n```\n\n## Contributing\n\n### Development Setup\n\nThe project uses static tests for easy debugging and CI integration:\n\n```bash\n# Clone the repository\ngit clone https://github.com/MACKAT05/sqlfluff-templater-schemachange\ncd sqlfluff-templater-schemachange\n\n# Install in development mode\npip install -e .\n\n# Install development dependencies\npip install -r requirements.txt\n\n# Install pre-commit\npip install pre-commit\npre-commit install\n```\n\nThe project includes static test files in the `tests/` directory for easy debugging and CI integration.\n\n### Testing\n\nThe project includes static test files for easy debugging:\n\n```bash\n# Run all tests\npython tests/run_tests.py\n\n# Run individual tests\npython tests/test_basic.py\npython tests/test_modules.py\npython tests/test_env_vars.py\npython tests/test_conditional.py\n```\n\n### Development Workflow\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test your changes:\n   ```bash\n   # Run all tests\n   python tests/run_tests.py\n\n   # Test SQLFluff integration\n   cd tests/basic && sqlfluff render test.sql\n   ```\n5. Pre-commit hooks will run automatically on `git commit`\n6. Submit a pull request\n\n### Note on Pre-commit\n\nThe pre-commit configuration uses local SQLFluff hooks that require the development package to be installed first. This avoids the chicken-and-egg problem of trying to install the package from PyPI before it's published.\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Related Projects\n\n- [SQLFluff](https://github.com/sqlfluff/sqlfluff) - The SQL linter this plugin extends\n- [schemachange](https://github.com/Snowflake-Labs/schemachange) - Database change management tool this integrates with\n- [Snowflake](https://www.snowflake.com/) - Cloud data platform\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A standalone SQLFluff templater providing schemachange-compatible Jinja templating without schemachange dependency",
    "version": "0.1.0",
    "project_urls": {
        "Bug Reports": "https://github.com/MACKAT05/sqlfluff-templater-schemachange/issues",
        "Documentation": "https://github.com/MACKAT05/sqlfluff-templater-schemachange",
        "Homepage": "https://github.com/MACKAT05/sqlfluff-templater-schemachange",
        "Repository": "https://github.com/MACKAT05/sqlfluff-templater-schemachange"
    },
    "split_keywords": [
        "sqlfluff",
        " templater",
        " schemachange",
        " snowflake",
        " database",
        " linting"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7d9b4fc8d0286328b0e463871c6948dd3fc84a318f7ad8a45c6f83c73bbdb348",
                "md5": "3fe978982e468fe93bebea2a848de16a",
                "sha256": "c219a0238f32ff697cfed571fff645940042f64761a9a1fc8fa455b41cf7ba49"
            },
            "downloads": -1,
            "filename": "sqlfluff_templater_schemachange-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3fe978982e468fe93bebea2a848de16a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9425,
            "upload_time": "2025-08-04T06:43:58",
            "upload_time_iso_8601": "2025-08-04T06:43:58.393168Z",
            "url": "https://files.pythonhosted.org/packages/7d/9b/4fc8d0286328b0e463871c6948dd3fc84a318f7ad8a45c6f83c73bbdb348/sqlfluff_templater_schemachange-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f13756275c43fc7d37c10ed73efeb527d6a162862e2708885263c1d966d89170",
                "md5": "01eeaef02934f5d61e225e981dddb5ef",
                "sha256": "7324532827333610698c68dc3da86b051ffdefe2f921a0e9b049eb04dbf9d445"
            },
            "downloads": -1,
            "filename": "sqlfluff_templater_schemachange-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "01eeaef02934f5d61e225e981dddb5ef",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15955,
            "upload_time": "2025-08-04T06:43:59",
            "upload_time_iso_8601": "2025-08-04T06:43:59.655700Z",
            "url": "https://files.pythonhosted.org/packages/f1/37/56275c43fc7d37c10ed73efeb527d6a162862e2708885263c1d966d89170/sqlfluff_templater_schemachange-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-04 06:43:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MACKAT05",
    "github_project": "sqlfluff-templater-schemachange",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "21.0.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "3.8.0"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    ">=",
                    "0.910"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "2.10.0"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "5.1"
                ]
            ]
        },
        {
            "name": "sqlfluff",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        }
    ],
    "lcname": "sqlfluff-templater-schemachange"
}
        
Elapsed time: 0.86843s