Repository navigation
v0.12.0
This release adds the driver trino, for Trino and Presto. No other driver changes for a caller.
New
- Trino and Presto. The package
trinoruns SQL on Trino and on Presto throughPOST /v1/statement, measured on Trino 476 and 483 and on Presto 0.299. One driver serves both, and Presto is a flavor. The driver tells the flavor from what the server says, and the keyflavorcan set it (D173 and D175). - DSN. The DSN is
trino://user@host:8080/catalog/schema. The keys aretls,source,timezone,timeout,flavorandsession.<name>, and the last one sets a property of the session. - Reading. A query follows
nextUripage by page and decodes each row as it arrives. An error that comes before any row is the error ofQueryContext. - Parameters. The servers take no bound parameter in a statement, so the driver writes each argument as a literal in a prepared statement and sends
EXECUTE name USING .... - Transactions.
BeginTxstarts a transaction of the server, and the driver carries its id in the header of each statement. - Cancel. The server runs a query on when its client leaves. The driver sends
DELETEto thenextUriwhen the context ends and when the caller closes the rows early. ADELETEaborts a transaction on Trino, so a connection that holds a transaction reads up to four small pages in place of theDELETE. - Types. A
DECIMALis an*apd.Decimal, and so is theNUMBERof Trino 483. A time is atime.Timeor one of the types of the root package. AnARRAYis a[]any, aMAPis amap[string]any, and aROWis a[]anyin the order of its fields. Both flavors give the same Go values, although Presto sends these types as JSON text. A time with picoseconds loses the digits beyond the ninth only when they are all zero, and fails when one is not zero (D175).
What a caller must know
- A
[]anyargument is anARRAY. To send aROW, writeCAST(JSON_PARSE(?) AS row(...))and pass JSON text. The driver has noRowtype. The names of the fields of aROWare in the type name of the column, anddocs/TRINO.mdlists the options to read them later. - The
memorycatalog of the test images refusesUPDATE,DELETEandMERGE, and Presto refusesTRUNCATEthere. The integration tests of these statements wait for a catalog that supports them. - A zero
dbimp.Intervalis anINTERVAL DAY TO SECOND, so it cannot go into aYEAR TO MONTHcolumn.
Other changes
- The command
dbimptest/cmd/recordfollows an absolutenextUriand can keep a header of a response with the captureheader:<name>. - Hard rule 4 of
AGENTS.mdnow lists the Trino transaction and the rows of a Trino query among the types that keep a context (D175). - ClickHouse is started in
docs/CLICKHOUSE.mdand D174. It has no driver yet.
Tests
CI passed all 30 jobs on the tagged commit, which includes the integration jobs of Trino 476 and 483 and of Presto 0.299, and the quick round trip of Druid.