Skip to content

Adds a SqlGlot implementation of the OSI SQL dialect#222

Open
willpugh wants to merge 4 commits into
mainfrom
willpugh/expression-language-sqlglot
Open

Adds a SqlGlot implementation of the OSI SQL dialect#222
willpugh wants to merge 4 commits into
mainfrom
willpugh/expression-language-sqlglot

Conversation

@willpugh

@willpugh willpugh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the expression language from the Ossie spec. Also, found a spec oversight, that caused an incompatibility with ANSII around NOT operator precedence. Having ANSII compliance was a clear requirement of the expression langauge group.

Updates the spec and implements the language as a SqlGlot dialect.

Related Issues

Checklist

Specification

  • Spec changes are included in core-spec/ and follow the existing structure
  • Spec changes have been discussed on the mailing list or in a linked issue
  • Breaking changes to the spec are clearly called out in the summary

Tests

  • All existing tests pass (pytest / CI green)
  • New functionality is covered by tests

Compliance

  • ASF license headers are present on all new source files
  • No third-party dependencies are added without PMC/IPMC approval

@willpugh
willpugh force-pushed the willpugh/expression-language-sqlglot branch from 7d34e38 to 2f2f84f Compare July 17, 2026 15:23
@willpugh
willpugh requested a review from jbonofre July 20, 2026 20:04
Comment thread python/ossie/src/ossie/models.py Outdated
from enum import Enum
from typing import Any, Optional, Union
from enum import StrEnum
from typing import Any

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the changes to this file models.py ? They look unrelated to the SQL dialect implementation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. It is making the type system better, but not strictly needed in this pr. I can remove it.

# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we rename this to python/src/ossie-model ? Right now it reads like /ossie/src/ossie which is confusing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we should stick with more cannonical Python pathing. Although, the naming will match what we come up with in Ossie Project Development Guidelines

Currently, that proposes core/python/ossie and core/python/ossie-sql

However, I was going to wait until that got settled before doing the change.

build-backend = "hatchling.build"

[project]
name = "apache-ossie"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ossie-model ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to export a package called ossie-model. When a user installs ossie, I think it should be apache-ossie not ossie-model.

So, i think we probably want to keep this.

Comment on lines +20 to +23
Implements the grammar defined in ``core-spec/expression_language.md``
("Ossie_SQL_2026"). Registers with SQLGlot as ``"ossie"``, so
``sqlglot.parse_one(sql, read="ossie")`` parses the spec's SQL subset and
``expression.sql(dialect="ossie")`` renders it back.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dialect name in the json spec and in the consumers should then just be "ossie" ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to update the json spec, etc. as a different PR. I'm trying to keep this one to just the SqlGlot dialect.

@khush-bhatia khush-bhatia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good , just some comments about some unrelated changes.

Thank for this, this is a great direction to standardize on the expression language.

@willpugh
willpugh force-pushed the willpugh/expression-language-sqlglot branch from 2f2f84f to c09d3b0 Compare July 23, 2026 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants