Which SQL Dialects Does Apache Ossie Support? Complete Guide
Apache Ossie supports seven SQL and analytical expression dialects—ANSI_SQL, SNOWFLAKE, MDX, TABLEAU, DATABRICKS, MAQL, and BIGQUERY—allowing models to define platform-specific expressions with automatic fallback to ANSI SQL.
Apache Ossie provides a cross-platform semantic layer for data models, enabling you to write expressions that work across different analytics engines. Understanding which Apache Ossie SQL dialects are supported is essential for building portable metrics and fields that render correctly on your target platforms.
Supported SQL Dialects Enumeration
The complete list of supported dialects is defined in core-spec/spec.yaml (lines 31-39) as a standard enum. According to the Apache Ossie source code, implementations recognize these seven dialect identifiers:
- ANSI_SQL: The baseline, portable SQL dialect defined by the ANSI standard. This serves as the universal fallback when platform-specific dialects are absent.
- SNOWFLAKE: Dialect optimized for Snowflake data warehouses.
- MDX: Microsoft Multi-Dimensional Expressions, used by OLAP tools.
- TABLEAU: Tableau's proprietary expression language.
- DATABRICKS: Databricks SQL dialect.
- MAQL: GoodData's Multi-Dimensional Analytical Query Language.
- BIGQUERY: Google BigQuery (GoogleSQL) dialect.
Multi-Dialect Expression Architecture
Ossie allows each field or metric to store multiple dialect-specific expressions simultaneously. As documented in core-spec/spec.md (lines 75-82), the expression schema contains a dialects array where you can provide variations for different platforms.
The fallback behavior operates as described in docs/index.md (lines 62-66): when a converter processes your model, it selects the expression matching its target platform. If that specific dialect is not provided, the converter automatically falls back to ANSI_SQL. This design ensures cross-platform portability while allowing optimization for specific warehouses.
Implementing Multi-Dialect Models
Declaring Fields with Multiple Dialects
In your Ossie YAML model, define the dialects array under the expression key to provide platform-specific variations:
fields:
- name: total_price
expression:
dialects:
- dialect: ANSI_SQL
expression: "price * quantity"
- dialect: SNOWFLAKE
expression: "price * quantity"
- dialect: BIGQUERY
expression: "price * quantity"
This configuration allows a Snowflake converter to select the SNOWFLAKE entry while generic processors use the ANSI_SQL version.
Configuring Vendor-Specific Metrics
Metrics follow the same pattern, as shown in core-spec/expression_language.md (lines 31-38). You can include platform-specific optimizations for complex calculations:
metrics:
- name: profit_margin
expression:
dialects:
- dialect: ANSI_SQL
expression: "(revenue - cost) / revenue"
- dialect: DATABRICKS
expression: "(revenue - cost) / revenue"
- dialect: MAQL
expression: "(revenue - cost) / revenue"
Python SDK Fallback Implementation
When consuming Ossie models programmatically, implement dialect selection logic that respects the fallback chain:
from ossie.models import load_model
model = load_model("my_model.yaml")
def get_expression(field, preferred="SNOWFLAKE"):
dialects = field["expression"]["dialects"]
# Check for preferred dialect
for d in dialects:
if d["dialect"] == preferred:
return d["expression"]
# Fallback to ANSI_SQL
for d in dialects:
if d["dialect"] == "ANSI_SQL":
return d["expression"]
return None
price_expr = get_expression(model["fields"][0])
This helper function mirrors the behavior of Ossie's built-in converters.
Summary
- Apache Ossie defines seven supported dialects in
core-spec/spec.yaml: ANSI_SQL, SNOWFLAKE, MDX, TABLEAU, DATABRICKS, MAQL, and BIGQUERY. - Each field and metric can contain multiple dialect-specific expressions stored in a
dialectsarray. - Converters automatically fall back to ANSI_SQL when a target-specific dialect is unavailable, ensuring model portability.
- The expression schema is documented in
core-spec/spec.mdandcore-spec/expression_language.md.
Frequently Asked Questions
What is the default SQL dialect in Apache Ossie?
ANSI_SQL serves as the baseline and default dialect. According to the source code in docs/index.md, when a converter cannot find an expression matching its specific platform (such as SNOWFLAKE or BIGQUERY), it automatically falls back to the ANSI_SQL expression. You should always provide an ANSI_SQL version of your expressions to ensure compatibility.
Can I use multiple SQL dialects in a single Ossie model?
Yes. Ossie encourages this approach for cross-platform portability. As defined in core-spec/spec.yaml, the dialects property accepts an array of dialect objects, allowing you to define optimized expressions for Snowflake, Databricks, BigQuery, and other platforms within the same field or metric definition.
How do converters handle missing dialect expressions?
Converters implement a fallback chain that prioritizes the target platform's specific dialect and defaults to ANSI_SQL if unavailable. This behavior is documented in the core specification at core-spec/spec.md (lines 75-82), ensuring that models remain functional even when platform-specific optimizations are not provided.
Does Apache Ossie support custom or proprietary SQL dialects?
The current enumeration in core-spec/spec.yaml defines seven standard dialects. While the specification in core-spec/expression_language.md discusses extensibility, custom dialects would require updates to the core enumeration and corresponding converter implementations to be recognized as first-class dialects.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →