Skip to content

feat: Trino contracts support#2585

Merged
paulteehan merged 114 commits intomainfrom
platl-345-trino-contracts-support
Feb 27, 2026
Merged

feat: Trino contracts support#2585
paulteehan merged 114 commits intomainfrom
platl-345-trino-contracts-support

Conversation

@paulteehan
Copy link
Contributor

@paulteehan paulteehan commented Feb 16, 2026

Description

Add support for Trino.

  • Tests were passing locally but CI is currently broken on a config error. I'll fix it ASAP, don't want to block reviews waiting for it
  • There are two Trino catalogs configured, db (postgres) and iceberg (s3). We're testing on both
  • Includes a local Trino docker image which is used in CI and can also be used for local testing. JWT token auth was tested locally; see soda-trino/local_instance/README.md
  • Type comparisons are coarse because some Trino connectors will downgrade types, e.g. smallint becomes int, varchar(255) becomes varchar etc.
  • The Trino dialect does support views, but not every Trino connector support view creation. Some new structure was added to handle this.

Checklist

  • I added a test to verify the new functionality.
  • I verified this PR does not break soda-extensions
    • pending

# It could be that the datasource has synonyms for the data types, and we want to handle that in the mappings.
# For an example: see the postgres implementation. We basically create a list of lists. Whereby each sublist contains the synonyms for a given SodaDataTypeName.
return []

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed during cleanup by Claude, unused

.column_varchar("id2", 100)
.column_integer("my_value")
.column_timestamp("my_timestamp")
.column_timestamp("my_timestamp", datetime_precision=6)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Claude fix, unsure about this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Generated by Claude, reviewed very lightly

Copy link
Contributor

@m1n0 m1n0 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for all the types investigation and testing on two different flavors!

Could you perhaps document (e.g. comments in code?) the flow of "can create (mat)views?" - the logic of when we call the actual "try to do it" instead of relying on a default is super easy to graps when approaching it from datasource (as opposed to approaching it from test suite) - and it might be useful for posterity


project_root_dir = __file__[: -len("/soda-core/tests/helpers/test_fixtures.py")]
load_dotenv(f"{project_root_dir}/.env", override=True)
project_root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity - is this so that directory name other than soda-core works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but also this path was actually wrong, file is soda-tests/src/helpers/test_fixtures.py, we've been relying on environment being loaded in the shell all this time. Claude choked on it and suggested this fix

_datasource = os.environ.get("TEST_DATASOURCE", "postgres")


def pytest_collection_modifyitems(config, items):
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm I get the motivation to prevent confusing local failures, but shouldn't we then stop running tests conditionally for datasources by pointing them at directories and use this mechanism instead? Now we have two completely separate ways to control this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take this out for now

@sonarqubecloud
Copy link

@paulteehan paulteehan changed the title Platl 345 trino contracts support feat: Trino contracts support Feb 27, 2026
@paulteehan paulteehan marked this pull request as ready for review February 27, 2026 12:11
@paulteehan paulteehan merged commit dca0f37 into main Feb 27, 2026
17 of 18 checks passed
@paulteehan paulteehan deleted the platl-345-trino-contracts-support branch February 27, 2026 12:12
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.

5 participants