Add Trino import and check its physical types - #1441
Merged
Conversation
Create a data contract from a Trino catalog with `datacontract import trino`, replacing a recipe that told users to run SHOW CREATE TABLE, import the DDL as postgres, and then fill in a placeholder servers block by hand. Trino physical type checks never ran: its information_schema has no character_maximum_length, numeric_precision or numeric_scale, so the catalog query failed with COLUMN_NOT_FOUND, the failure was swallowed, and a wrong physicalType still passed. Its data_type is already a complete type string, the same shape Athena reports, so both now use that reader.
📖 Docs previewPreview site: https://brave-water-0cee36e03-1441.westeurope.7.azurestaticapps.net Changed pages (most-changed first):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
datacontract import trino, and fixes a silent hole in Trino testing found while building it.The guide previously said: run
SHOW CREATE TABLE, save the DDL, import it with thepostgresdialect, then fill in aserversblock of placeholder values.Trino physical type checks never ran
_CATALOG_STRATEGYmapped Trino to theinformation_schemareader, which selectscharacter_maximum_length,numeric_precisionandnumeric_scale. Trino'sinformation_schema.columnshas none of those — it has eight columns and no length or precision at all:So the query failed with
COLUMN_NOT_FOUND,_rows()swallowed it, and the check was skipped with a debug log nobody sees.Demonstrated against a real Trino. A contract declaring
order_idasintegerwhen the column isvarchar(36):information_schema)full_type)expected physical type 'integer' but the column is 'varchar(36)'Trino's
data_typeis already a complete type string, the same shape Athena reports, so both now share that reader — renamed from_read_athenato_read_full_type_information_schemasince it is no longer Athena-specific.Verified against a real Trino
Import followed by
datacontract teston the unedited file: 12/12 checks passed, with the types taken verbatim:Those physical type checks are now genuinely evaluated rather than skipped.
Testing
tests/test_import_trino.py— 9 tests against a real Trino container, reusing the container helper the existing suite defines. One pins the fix directly: a wrongphysicalTypemust now fail. The existing Trino suites pass unchanged (17 tests total).Docs
New
imports/trino.md;testing/trino.mdgets the one-command step 3, step 2 renamed to "Authenticate", and step 4 now shows the check table like the other guides instead of only the summary line.