Enforce SQL and YAML Best Practices
Last updated
Last updated
Paradime offers integrated tools like SQLFluff and Prettier to help enforce best practices for SQL and YAML files, ensuring high-quality code and reducing errors in your dbt™ project. Estimated completion time: 20 minutes
Basic understanding of SQL and YAML syntax
In this guide, you'll learn how to:
Use SQLFluff to lint and format SQL files
Utilize Prettier to format and debug your YAML files
Customize settings for both tools to match your team's standards
SQLFluff is an integrated linting tool in Paradime that helps maintain consistent, high-quality SQL code. The pre-configured template is for Snowflake and dbt, setting basic rules for SQL formatting such as line length, indentation, aliasing, and capitalization. It provides a foundation for consistent SQL styling that can be easily customized to fit specific project needs.
Key Features:
Integrated Linting: Automatically check SQL code against standard or custom rules.
Pre-configured for dbt™: Comes ready to use with basic rules tailored for dbt™ projects.
Real-time Formatting: Use the 'Prettier' button in Paradime's IDE for instant code corrections.
How to Use SQLFluff:
Select a .sql file within your dbt™ project.
Click the Prettier
button in the commands panel to automatically format your .yml file.
Optional: Customize your SQL formatting by creating a .sqlfluff file in your dbt™ root directory (this is in the same directory where your dbt_project.yml lives).
If you don't have a .sqlfluff
file in your project, simply create new file with the exact name ".sqlfluff" in the same directory where your dbt_project.yml
lives.
Prettier is an integrated code formatter in Paradime that helps maintain consistent, error-free YAML files in your dbt™ project. Prettier comes pre-installed in your project and uses default configurations provided by the Prettier library, which can be easily customized to fit specific YAML preferences.
Key Features:
Automatic Formatting: Formats YAML files for improved readability and code quality.
Error Detection: Highlights severe formatting errors and assists in debugging.
Customization: Allows custom configurations through a .prettierrc file.
How to Use:
Select a .yml file within your dbt™ project.
Click the Prettier
button in the commands panel to automatically format your .yml file.
If more severe errors are detected, click the Prettier
button in the toolbar to debug.
Optional: Customize your YAML formatting by creating a .prettierrc file in your dbt™ root directory (this is in the same directory where your dbt_project.yml lives).
By using SQLFluff and Prettier in Paradime, you enforce best practices across your SQL and YAML files. These tools help maintain consistent, clean, and high-quality code, improving your project's readability and reducing errors. Customize them to fit your team's coding standards, streamline your workflow, and keep your dbt™ project error-free.
Next, we'll explore how to work with CSV files in Paradime.