Settings
The settings component in DUQL allows you to specify metadata and configuration options for your query. This includes version information and target database specifications, which can affect how your query is processed and executed.
Syntax
settings:
version: <version_string>
target: <target_database>Parameters
version
string
Yes
The version of DUQL being used
target
string
Yes
The target database or SQL dialect for the query
Supported Targets
sql.clickhousesql.duckdbsql.genericsql.glaredbsql.mysqlsql.postgressql.sqlite
Examples
Basic Settings
settings:
version: '0.0.1'
target: sql.postgresSettings for a Different Database
settings:
version: '0.0.2'
target: sql.clickhouseUse Cases
Version Control: Specify the DUQL version to ensure compatibility with the parser and runtime environment.
Database-Specific Optimizations: The
targetsetting allows the DUQL engine to generate optimized SQL for specific database systems.Feature Availability: Certain DUQL features may only be available in specific versions or for certain database targets.
Query Portability: By explicitly stating the target, you can ensure that your query will work as expected when moved between different database environments.
Best Practices
📌 Always specify both the
versionandtargetin your settings to ensure consistent behavior across different environments.🔄 Keep your DUQL version up-to-date to leverage the latest features and improvements. Check the changelog when upgrading to be aware of any breaking changes.
🎯 Choose the most specific target that matches your database system. Using
sql.genericmay result in suboptimal performance or feature limitations.📚 Familiarize yourself with the specific features and limitations of your chosen target database to make the most of DUQL's capabilities.
🧪 When developing queries that need to work across multiple database systems, test with each target to ensure compatibility.
Related Components
All DUQL components are affected by the
settings, as they determine the available features and the SQL generation process.
Limitations and Considerations
The available features and syntax may vary depending on the specified
versionandtarget. Consult the DUQL documentation for your specific version and target for detailed information.Some advanced or database-specific features may not be available when using the
sql.generictarget.Changing the
targetsetting may require adjustments to your query if you've used any database-specific functions or syntax.
💡 Tip: The
settingscomponent is crucial for ensuring your DUQL queries are interpreted and executed correctly. Always start your DUQL files with a clearsettingssection to make your queries more robust and portable across different environments!
Last updated
Was this helpful?