This file holds what is known about Databricks over its SQL Statement Execution API, for the
driver databricks (W39, D188 and D193). The first release that held the driver was
v0.17.0, on 2026-10-11. The headings are the template of
DRIVER.md. A fact is "recorded", with the name of its request in
quotes, "measured", with the date, or "not measured", with its source.
Step 6 recorded one login on 2026-10-10, as one run of 331 requests, on a Databricks
Free Edition workspace on AWS in the region us-east-2. The workspace has a Serverless
Starter Warehouse of size 2X-Small and type PRO, with the catalog workspace and
the schema dbimp. The login is a personal access token of one service principal.
The principal owns the schema dbimp and holds USE CATALOG on workspace
(recorded: "the warehouse", "the schemata"). The host and the warehouse id are
redacted in the files as dbc-00000000-0000 and 1111222233334444. The
recordings are under testdata/databricks/, and testdata/databricks/requests.json is
the script. The script drops every table that it makes, at its start and at its end.
A fact marked "source: documentation" comes from the Databricks documentation of the Statement Execution API and of OAuth. This work made no network call, so the agent wrote those facts from what it knows of the documentation and did not open it on 2026-10-10. Ken or a later pass must make sure of each one before a decision rests on it. The live run of 2026-10-11 (see Integration tests) tested the driver against the real service, and this document names each fact that it settled.
The recordings give no fact about two things, and both are named where they matter. The first is the body that a presigned link returns, because the recorder sends every request with the token and never fetched a link. The second is a statement that runs longer than 50 seconds, because every statement that the script sent finished in about 5 seconds.
- Product: Databricks, a hosted lakehouse. The service answers SQL on a SQL
warehouse, and the engine is Spark SQL with its own additions.
SELECT version()answers4.2.0and a 40 character build hash (recorded: "the version"). The release of the SQL warehouse channel is2026.38(recorded: "the history of queries", the memberchannel_used). There is no release to choose, because the service has one. The measured release is "databricks", anddbrunhas no name for it (read ofdbmeta/container, 2026-10-10). - R: fails. Databricks has no emulator,
dbrunhas no entry for it, and a login needs a token of a workspace.dbmeta/hosted/hosted.golists it as a hosted service with the formdatabricks://token:<personal access token>@<workspace>.databricks.com:443/sql/1.0/endpoints/<warehouse id>and no emulator (read, 2026-10-10). CI cannot test it without a secret. D188 says so, and D193 item 10 decided that the integration tests run only where a person supplies a workspace. - H: passes.
POST /api/2.0/sql/statementstakes JSON and answers JSON (recorded: "a statement"). The rows of the default form are JSON text, and no binary encoding is needed (recorded: "a statement with the format JSON_ARRAY and the disposition INLINE"). The API can also answer in the Arrow stream form, which only the dispositionEXTERNAL_LINKSallows (recorded: "a statement with the format ARROW_STREAM and the disposition INLINE"). - S: passes. The dialect is Spark SQL as Databricks runs it, with
ANSImode on by default (recorded: "a division by zero"). It answeredSELECT,INSERT,UPDATE,DELETE,MERGE,TRUNCATE,CREATE TABLE,ALTER TABLE,CREATE VIEWand SQL scripts (recorded: "a select of the rows", "an insert and its answer", "an update and its answer", "a delete and its answer", "a merge and its answer", "a truncate", "an alter table that adds a column", "a create view", "a script with a compound statement"). The priority is the request of Ken on 2026-10-10 (D188). - Whether it can be a driver: yes, over HTTP and JSON with no Arrow. No condition
of "When it cannot be a driver" failed on the recordings, and one is at risk.
- The columns and their order come before the first row. The member
manifestcomes before the memberresultin the body, and it holdsschema.columnsin the order of the statement, with aposition(recorded: "columns of a result with rows", "columns in the order of the statement"). A result with no rows still has the columns (recorded: "columns of a result with no rows"). A statement that returns nothing hascolumn_countof 0 and nocolumns(recorded: "a statement with no result"). - A result can be read one row at a time. An inline chunk is one JSON object
whose member
data_arrayholds one array for each row, so a decoder can read it token by token (recorded: "3000 rows of 300 characters", a body of 935384 bytes with one chunk). The shape of the body behind a presigned link is not recorded. - A result is never cut with no sign when the driver sends no limit.
manifest.truncatedistruewhenrow_limitorbyte_limitcut it (recorded: "3000 rows with the row limit 10", "3000 rows with the byte limit 1000"), andfalsefor 3000 rows with no limit (recorded: "3000 rows of two narrow columns"). - The condition at risk is D21 for a large result. Every result that the script
made came in one chunk, up to 3000 rows and 3 MB (recorded: "3000 rows of 300
characters", "3000 rows of 1000 characters as external links"), so no
recording shows a result of more than one chunk, the member
next_chunk_index, or what the server does with an inline result above its limit of 25 MiB. The request memberbyte_limithas the range 1 to 26214400, which is 25 MiB (recorded: "3 rows with the byte limit 0"). Documentation says that an inline result holds at most 25 MiB and a result of external links up to 100 GiB (not measured, source: documentation). A second live pass must send a result of more than 25 MiB with each disposition. - The package does not need Arrow, Thrift or the cloud fetch of Arrow (D13).
A driver that wants a result above the inline limit needs the second kind of
fetch, which is a
GETto a presigned link of another host with noAuthorizationheader (see Responses).
- The columns and their order come before the first row. The member
- What is lossy or hard in this form, as far as the recordings show:
- Every value is text, and a driver must decode it by
type_nameandtype_text(see Types). - A
TIMESTAMPand aTIMESTAMP_NTZkeep only milliseconds in the text. The value2024-01-02 03:04:05.123456arrived as2024-01-02T03:04:05.123Z, also from a stored column (recorded: "the timestamp type", "the rows of every type"). The text of a link ofJSON_ARRAYis not recorded, so whether it keeps the microseconds is not measured. - An
ARRAY, aMAPand aSTRUCTarrive as JSON text in one string, and every leaf is a string, such as["1","2"]for an array ofINT. A driver needs the grammar oftype_textto decode the leaves (recorded: "the array type", "nested complex types"). - The session does not last.
SET,USE, a temporary view and a declared variable do not reach the next request (see Transactions). - The first statement after the warehouse stopped takes about 15 seconds, and the request waits for it (recorded: "setup: warm the warehouse").
- Every value is text, and a driver must decode it by
- Scheme in
dburl:Nameisdatabricks, the aliases arebr,brick,bricksanddatabrick, the generator isgenSchemeSuffix("databricks", ".cloud.databricks.com", true), and theDialectisdatabricks. The deployment is hosted.GoPackageisgithub.com/xo/dbimp/databricks. The generator rewrites the scheme, returns an error when the URL names no host, and adds.cloud.databricks.comonly to a host that has no dot and no port (read ofdburl/scheme.goanddburl/dsn.go, 2026-10-10). A host of Azure or of Google Cloud has dots, so it passes unchanged (read ofdburl/dburl_test.go, 2026-10-10). - Driver of
usqlnow:github.com/databricks/databricks-sql-gov1.16.0. It uses Thrift over HTTP and Arrow, and it has an optional backend of Rust bindings behind the build tagdatabricks_kernel(read ofusql/go.modand of the module, 2026-10-10).usqlregisters it with an error hook only, sousqlhas noVersionstatement for it (read ofusql/drivers/databricks/databricks.go, 2026-10-10).usqllists its cost as 4.6, with its SDK and Arrow v12 as the cause (read ofusql/docs/BACKLOG.md, 2026-10-10). - What
dbmetahas: the dialectdatabricksand the entry of the hosted service, with no container and no model (read ofdbmeta/dialect.goanddbmeta/hosted/hosted.go, 2026-10-10).
- A statement is
POST /api/2.0/sql/statementswith a JSON body, the headerContent-Type: application/json, and the answerContent-Type: application/json(recorded: "a statement"). The path/api/2.0/sql/statements/with a trailing slash gave the same answer (recorded: "a request with a trailing slash"), and a query string was ignored (recorded: "a request with a query string"). - The body has these members, each one recorded:
warehouse_idis required. A body with none gets HTTP 400 with the codeBAD_REQUEST(recorded: "a body with no warehouse", "a body that is an empty object", "an empty body").statementis required (recorded: "a body with no statement"). An empty text is HTTP 200 and the stateFAILED(recorded: "an empty statement").catalogandschemaset the namespace of the statement (recorded: "the catalog and the schema"). With neither, the namespace is the catalogworkspaceand the schemadefault(recorded: "a statement with no catalog and no schema"). A catalog or a schema that does not exist is not an error when the statement names no table, becauseSELECT 1ran (recorded: "a missing catalog", "a missing schema"). Whatcurrent_schema()answers then is not measured.wait_timeoutis a text such as"5s". It is"0s", or from"5s"to"50s"."51s"gets HTTP 400 withINVALID_PARAMETER_VALUEand the message "The wait_timeout field must be 0 seconds (disables wait), or between 5 seconds and 50 seconds." (recorded: "a wait timeout that is too long"). Text such as"soon"gets HTTP 400 with "Error while parsing type: duration." (recorded: "a wait timeout that is text"). With nowait_timeoutthe call waited, and the answer was complete forSELECT 1(recorded: "a statement with no wait timeout"). The default value is not measured (source: documentation says 10 seconds).on_wait_timeoutisCONTINUEorCANCEL. The server ignores any other value (recorded: "an on_wait_timeout that is not known").row_limitis an integer from 0 to 2147483647, andbyte_limitis an integer from 1 to 26214400 (recorded: "3 rows with the row limit that is negative", "3 rows with the byte limit 0"). Zero rows is not "no limit":row_limit0 gave no row andtruncatedoftrue(recorded: "3000 rows with the row limit 0").dispositionisINLINEorEXTERNAL_LINKS, andformatisJSON_ARRAY,ARROW_STREAMorCSV. The combinations are in Responses. A disposition or a format that is not known is ignored, and the answer has the default (recorded: "a disposition that is not known", "a format that is not known").parametersis a list of{"name", "value", "type"}(see Parameters).query_tagsis a list of{"key", "value"}. The server took it (recorded: "a statement with query tags"). The server also took a member that does not exist (recorded: "a member that does not exist"), so the answer does not show that the tags have an effect.
- The authentication is a Bearer token in the header
Authorization. The token is a personal access token (recorded: every request, where the header is redacted in the files). TheAcceptheader wasapplication/json, and the server answered JSON with noAccepttoo (recorded: "a request with an accept encoding of identity"). A body ofContent-Type: text/plainwas read as JSON (recorded: "a request with a content type of text"), and a body withContent-Encoding: gzipthat was not gzip was read as plain JSON (recorded: "a request with a content encoding of gzip that is not gzip"). - OAuth machine to machine: the client sends
POST https://<host>/oidc/v1/tokenwith HTTP Basic authentication of the client id and the client secret of a service principal, and the formgrant_type=client_credentials&scope=all-apis. The answer holdsaccess_token, which the client then sends as a Bearer token, andexpires_inof 3600 seconds (not measured, source: documentation). The token of the script was a personal access token, so this flow was not sent. - A read of a statement is
GET /api/2.0/sql/statements/{statement_id}. A read of one chunk isGET /api/2.0/sql/statements/{statement_id}/result/chunks/{chunk_index}. A cancel isPOST /api/2.0/sql/statements/{statement_id}/cancel, and it answers{}(recorded: "the statement of the wait timeout of 0s, at once", "the chunk 0 of the 3000 rows", "a cancel of the heavy statement"). - Other endpoints of the REST API that the script read as the same principal:
GET /api/2.0/sql/warehouses/{id}andGET /api/2.0/sql/warehousesanswered HTTP 200 (recorded: "the warehouse", "the list of warehouses"). The answer holds thestate, the size,auto_stop_minsof 10,auto_resumeoftrue,jdbc_urlandodbc_paramswith the host and the path/sql/1.0/warehouses/<id>.GET /api/2.0/sql/config/warehousesanswered HTTP 403 withPERMISSION_DENIED(recorded: "the configuration of the warehouses").GET /api/2.1/unity-catalog/tablesandGET /api/2.1/unity-catalog/schemasanswered HTTP 200 (recorded: "the list of tables in Unity Catalog", "the list of schemas in Unity Catalog").GET /api/2.0/sql/history/queriesanswered HTTP 200 with a page and anext_page_token(recorded: "the history of queries"). It holds the memberstatement_typeandclient_applicationofGo-http-client, and the text of each query is redacted.
- A method or a path that the API does not have answers HTTP 404.
PUTandGETwith no id, and the path/api/2.0/sql/statements/execute, got the codeENDPOINT_NOT_FOUNDwith the message "No API found for 'PUT /sql/statements'" and the like (recorded: "a request that is PUT", "a request that is GET with no id", "a request to the old path"). A path under/api/2.0/sql/that does not exist got HTTP 404 with an empty body (recorded: "a request to a path that does not exist").DELETE /api/2.0/sql/statements/{id}answered HTTP 200 and{}and left the statement readable (recorded: "a request that is DELETE of a statement", "the first statement after 16 minutes"). So the API has no call that closes a statement.
These are the facts that a DSN must carry. The form is for step 9 and D27 to decide.
- The host of the workspace. The forms of the three clouds are:
- AWS:
<name>.cloud.databricks.com. The host of the workspace measured here isdbc-<8 hex>-<4 hex>.cloud.databricks.com, with the digits redacted in the files (recorded: "the warehouse", the memberjdbc_url). - Azure:
adb-<workspace id>.<n>.azuredatabricks.net(not measured, source: documentation). - Google Cloud:
<workspace id>.<n>.gcp.databricks.com(not measured, source: documentation). - The port is 443 and the scheme is HTTPS (recorded: "the warehouse", the member
odbc_params).
- AWS:
- The credential is one of:
- A personal access token, sent as a Bearer value (recorded: every request).
- A client id and a client secret of a service principal, which the driver exchanges
at
/oidc/v1/tokenfor an access token (not measured, source: documentation). databricks-sql-gotakes the token as the user nametokenand the secret as the password of the URL,token:<token>@<host>:<port>/<http path>, and takesclientIDandclientSecretas keys of the query for OAuth machine to machine (read ofdoc.goandCONNECTION_PARAMETERS.mdof v1.16.0, 2026-10-10). D94 says that the secret is the password of the URL.
- The warehouse. The body takes the bare warehouse id as
warehouse_id. It is 16 lower case hex digits (recorded: "the warehouse"). A warehouse id that is not valid gets HTTP 400 and the message "nosuch is not a valid endpoint id." (recorded: "a warehouse id that is not valid"). An id with a valid form that names no warehouse the principal can use gets HTTP 403 withPERMISSION_DENIEDand the message "You do not have permission to use the SQL Warehouse. Please contact your administrator." (recorded: "a missing warehouse"). Thehttp_pathof the ODBC and JDBC drivers is/sql/1.0/warehouses/<id>(recorded: "the warehouse", the memberodbc_params). The older path/sql/1.0/endpoints/<id>is the form thatdbmetalists (read ofdbmeta/hosted/hosted.go, 2026-10-10), and whether the Statement Execution API accepts either path is not measured, because the API takes the bare id. catalogandschema, as members of the body, both optional (see Requests).- Anything that sets a time, such as a wait, comes from the caller for each statement (see Cancellation and timeouts).
dburlwritesdatabricks://token:<token>@<host>/<path>?.... The tests ofdburlshow the formsdatabricks://token:key@host.cloud.databricks.com/path,databricks://token@dbc-1234.cloud.databricks.com/sql?timeout=1manddatabricks://token@adb-1.2.azuredatabricks.net/sql, with the keystimeoutandmaxRowsthatdatabricks-sql-goreads (read ofdburl/dburl_test.go, 2026-10-10).- The warehouse can be asleep, and the first statement then waits about 15 seconds (see Cancellation and timeouts).
- The answer is one JSON object. The members come in the order
statement_id,status,manifest,result(recorded: "a statement"). The answer is not chunked as a stream of rows by the server. The inline rows are one array in the memberresult.data_array, in one body (recorded: "3000 rows of 300 characters"). statement_idis a UUID text such as01f1c46b-c6a4-1a9a-9f97-7eff37bf8459(recorded: "a statement"). A statement id that is not a UUID gets HTTP 400 with "Error while parsing type: statement_id." (recorded: "a statement id that is not valid"), and a UUID that is not known gets HTTP 404 withNOT_FOUND(recorded: "a statement id that does not exist").status.statetook these values:PENDING,SUCCEEDED,FAILEDandCANCELED(recorded: "the statement of the wait timeout of 0s, at once" and others).RUNNINGnever arrived, because no statement stayed in the engine long enough to be polled. Documentation namesPENDING,RUNNING,SUCCEEDED,FAILED,CANCELEDandCLOSED(not measured, source: documentation). No recording showsCLOSED.- A statement that is still
PENDINGhas onlystatement_idandstatus.state(recorded: "a statement with a wait timeout of 0s"). A statement that failed hasstatus.errorwitherror_codeandmessage, andstatus.sql_state, and nomanifestand noresult(recorded: "a syntax error"). A statement that succeeded and returned no rows has amanifestandresultof{}(recorded: "the answer of a statement that returns no rows"). manifesthasformat,schema,total_chunk_count,chunks,total_row_countandtruncated. With external links it hastotal_byte_counttoo, and each chunk hasbyte_count(recorded: "a statement with the format JSON_ARRAY and the disposition EXTERNAL_LINKS"). With no rows,total_chunk_countis 0 andchunksis left out.schemahascolumn_countandcolumns.- Each column has
name,position,type_nameandtype_text. ADECIMALhastype_precisionandtype_scale, and anINTERVALhastype_interval_type(recorded: "the decimal types", "the interval year to month types"). No column has a member for NULL or for the length of a string (recorded: "the rows of every type"), so nullability is not known. - Names of columns: the name is the text of the alias, or the text of the expression
when there is no alias, such as
1,xand2.5forSELECT 1, 'x', 2.5(recorded: "columns with no name"). A name can have a space, a dot and upper case letters (recorded: "a column with a name that has a space and a dot"). Two columns can have one name (recorded: "columns that share a name"). The order is the order of the statement (recorded: "columns in the order of the statement").SELECT 1 FROMwith nothing afterFROMran and named the columnFROM(recorded: "a syntax error at the end"). - A row is an array of text values. A NULL is JSON
null(recorded: "a NULL of each scalar type", "a row of NULL in every type"). An empty string is""(recorded: "the string type"). A row keeps the order of the columns (recorded: "a row of every type"). - Dispositions and formats, as recorded for one statement:
INLINEwithJSON_ARRAYis the default, and the rows are inresult.data_array(recorded: "a statement with the format JSON_ARRAY and the disposition INLINE").INLINEwithARROW_STREAMor withCSVgets HTTP 400 withINVALID_PARAMETER_VALUEand the message "Incompatible parameters: The format field must be JSON_ARRAY when the disposition field is INLINE." (recorded: "a statement with the format ARROW_STREAM and the disposition INLINE", "a statement with the format CSV and the disposition INLINE").EXTERNAL_LINKStakesJSON_ARRAY,ARROW_STREAMandCSV, andresultthen holdsexternal_linksand nodata_array(recorded: "a statement with the format JSON_ARRAY and the disposition EXTERNAL_LINKS", "a statement with the format ARROW_STREAM and the disposition EXTERNAL_LINKS", "a statement with the format CSV and the disposition EXTERNAL_LINKS"). The one row ofSELECT 1 AS a, 'x' AS bhad abyte_countof 11 inJSON_ARRAYand of 456 inARROW_STREAM. The row of theCSVstatement had four columns and abyte_countof 26.
- An external link has
chunk_index,row_offset,row_count,byte_count,external_linkandexpiration. It has nonext_chunk_indexand nohttp_headers(recorded: "the statement of the disposition EXTERNAL_LINKS"). Theexternal_linkis an HTTPS URL on the hostus-east-2.storage.cloud.databricks.com, which is a host of the region of the workspace and not the host of the workspace. Its path starts/api/2.0/fs/files/and its query holdsX-Databricks-TTL=899996,X-Databricks-IssuedandX-Databricks-Signature(recorded: the same request). Theexpirationis 15 minutes after the answer (recorded: "the statement of the disposition EXTERNAL_LINKS", where the answer came at 05:32 andexpirationwas 05:47). - A read of the statement, or of the chunk, gives a new link with a new
expiration(recorded: "the chunk 0 of the statement of the disposition EXTERNAL_LINKS", "the statement of external links after 16 minutes", "the chunk 0 of the statement of external links after 16 minutes"). A link that is older than itsexpirationis not recorded, so what the host of the link answers for it is not measured. - What a driver needs to fetch a link: a
GETof the URL, with noAuthorizationheader, because the link carries its own signature, and the body is the chunk in the format that was asked (not measured, source: documentation). The recordings hold the answer that carries the links and never the fetch, because the recorder adds the token to every request. Whether the body ofJSON_ARRAYis a JSON array of arrays of text, and whether a timestamp in it keeps the microseconds, are the first questions of a second live pass. - Chunks: the recordings show one chunk for each statement, so the member
next_chunk_indexand the way to read a second chunk are not recorded. A read ofchunks/1of a result with one chunk gets HTTP 400 withINVALID_PARAMETER_VALUEand the message "The chunk_index 1 is out of bounds." (recorded: "the chunk 1 of the 3000 rows", "the chunk 1 of the rows of 300 characters", "the chunk 99 of the rows of 300 characters", "the chunk 1 of the rows as external links"). The reason is that the result has one chunk. The read of chunk 0 gave the same rows as the statement (recorded: "the chunk 0 of the 3000 rows"). A read of a chunk of a statement that failed gets HTTP 404 withNOT_FOUNDand the description "the statement state should be SUCCEEDED before you can start fetching the result" (recorded: "the failed statement, chunk 0"). Documentation says that a chunk hasnext_chunk_indexandnext_chunk_internal_linkwhen another chunk follows (not measured, source: documentation). - Caps and limits:
row_limitandbyte_limitcut the result and settruncated. A result of 3000 rows with no limit came whole in both dispositions. The rows withbyte_limitof 1000 were not a part of the first rows: no row arrived, andtruncatedwastrue(recorded: "3000 rows with the byte limit 1000"). So abyte_limitsmaller than the first chunk gives an empty result, and the driver must send none. - Compression: the server compresses with gzip when the request says
Accept-Encoding: gzip, and the answer hasContent-Encoding: gzipandVary: Accept-Encoding(recorded: "a request with an accept encoding of gzip"). Withidentitythe answer is plain (recorded: "a request with an accept encoding of identity"). - Redirects: no recorded answer redirected. The links are separate hosts and the API answered 200 or 4xx only.
- Headers of every answer include
Server: databricks,X-Request-Id,X-Databricks-Org-Id,Server-Timingwithrequest_ttfb_msec, andStrict-Transport-Security. The id of the request is the same asrequest_idin thedetailsof an error.
The type_name is the type of the Statement Execution API. The type_text is the type as
Spark writes it, with its parameters and its nested types. A type_name and a type_text
differ for the integers: TINYINT is BYTE, SMALLINT is SHORT and BIGINT is LONG
(recorded: "the integer types and their limits"). Each value is text.
TINYINT,SMALLINT,INTandBIGINTare decimal text, such as"-128","32767","2147483647"and"-9223372036854775808"(recorded: "the integer types and their limits"). A literal aboveBIGINThas the typeDECIMAL(19,0)orDECIMAL(20,0), and not an integer type, such as"18446744073709551615"(recorded: "an integer larger than BIGINT").FLOATandDOUBLEare the text of Java, such as"1.5","0.1","1.6777216E7","1.7976931348623157E308","4.9E-324"and"0.0"for the negative zero (recorded: "the floating point types").NaN,Infinityand-Infinityarrive as that text, in both types (recorded: "the special floating point values of DOUBLE", "the special floating point values of FLOAT"). The text of aFLOATis the shortest text of a 32 bit value, so0.1stands for the nearestfloat32.DECIMAL(p,s)haspup to 38 andsup to 38. The text keeps the scale, such as"1.50"forDECIMAL(10,2)and"0.00000"for zero ofDECIMAL(10,5), and it holds 38 digits exact, such as"99999999999999999999999999999999999999"and"0.99999999999999999999999999999999999999"(recorded: "the decimal types", "the longest decimals"). The manifest namestype_precisionandtype_scale.BOOLEANis the text"true"or"false"(recorded: "the boolean type"). A JSON boolean never arrives.STRINGis UTF-8 text, and it keeps an empty string, a space, multi byte characters, a quote, a backslash, a newline and a tab (recorded: "the string type"). A column ofCHARorVARCHARis not recorded, and the show of a table namesSTRING COLLATE UTF8_BINARY(recorded: "show create table"). The limit on the size of a string is not measured.BINARYis base64 text with padding, such as"3q2+7w=="forDEADBEEF,"YWJj"forabc,"AA=="for one zero byte, and""for an empty value (recorded: "the binary type").DATEis"2024-01-02", from"0001-01-01"to"9999-12-31", and"1500-06-15"is exact (recorded: "the date type").TIMESTAMPis an instant in UTC. The text is"2024-01-02T03:04:05.123Z", with three digits of fraction and the letterZ, from"0001-01-01T00:00:00.000Z"to"9999-12-31T23:59:59.999Z"(recorded: "the timestamp type"). A literal with the offset+05:30arrived as the instant in UTC,"2024-01-01T21:34:05.123Z", and the offset is not in the text. The value had six digits of fraction, and the text has three, cut and not rounded (.123456became.123), also for a value read from a stored column (recorded: "the rows of every type"). So the text loses microseconds. The session time zone wasEtc/UTC(recorded: "the time zone of the session"), and aSET TIME ZONEdid not reach the next request (recorded: "the time zone in the next request"), so the zone of aTIMESTAMPis always UTC for this API.TIMESTAMP_NTZhas no zone. The text is"2024-01-02T03:04:05.123", with three digits and noZ, from"0001-01-01T00:00:00.000"to"9999-12-31T23:59:59.999"(recorded: "the timestamp_ntz type"). It loses microseconds asTIMESTAMPdoes.INTERVALhastype_nameINTERVALand the membertype_interval_type, with the valuesYEAR,MONTH,YEAR TO MONTH,DAY,HOUR,MINUTE,SECONDandDAY TO SECOND(recorded: "the interval year to month types", "the interval day to second types"). The text is an SQL literal, such as"INTERVAL '1-2' YEAR TO MONTH","INTERVAL '-1-2' YEAR TO MONTH","INTERVAL '5' YEAR","INTERVAL '1 02:03:04.123456' DAY TO SECOND","INTERVAL '-1 02:03:04.5' DAY TO SECOND","INTERVAL '10' HOUR"and"INTERVAL '01.5' SECOND". A fraction of microseconds is kept. The range of a day to second interval is not measured (source: documentation says 106751991 days, not recorded).ARRAY<T>is a JSON array in one string, with every leaf as text:"[\"1\",\"2\",\"3\"]"for an array ofINT,"[]"for an empty array,"[null,\"1\"]"for a NULL element (recorded: "the array type"). A NULL array is JSONnulland not"[]"(recorded: "a NULL of each complex type").type_textholds the element type, such asARRAY<ARRAY<INT>>, and an empty array hasARRAY<VOID>.MAP<K,V>is a JSON object in one string, such as"{\"a\":\"1\",\"b\":\"2\"}". The keys of a map ofINTare text keys,"{\"1\":\"x\"}", so the key type is only intype_text. An empty map is"{}"and a NULL value isnull(recorded: "the map type").type_textwrites a space after the comma, as inMAP<STRING, INT>.STRUCT<...>is a JSON object in one string, with the fields in the order of the type, such as"{\"a\":\"1\",\"b\":\"x\"}". A NULL field isnull.type_textholds the names and types and the markNOT NULL, such asSTRUCT<a: INT NOT NULL, b: STRING NOT NULL>, and a struct with no names has the fieldscol1,col2(recorded: "the struct type"). A NULL struct is JSONnull(recorded: "a NULL of each complex type").- Nested values hold the text form of their element types: binary as base64, a timestamp with three
digits and
Z, a decimal with its scale, and a date, such as"[\"3q2+7w==\"]","[\"2024-01-02T03:04:05.000Z\"]","[\"1.50\"]"and"[\"2024-01-02\"]"(recorded: "nested complex types"). A struct of a map of an array stays one string with every leaf as text. VARIANTis JSON text in one string, with real JSON types:"{\"a\":1,\"b\":[1,2,\"x\"]}","1.5","\"s\""and"null"for a JSON null. A SQL NULL is JSONnull(recorded: "the variant type", "the rows of the table with a variant column"). So a number in aVARIANTis a JSON number and a number in anARRAYis text.GEOMETRYandGEOGRAPHYare WKT text. The columntype_textisGEOMETRY(0)orGEOGRAPHY(4326), and the text is"POINT(1 2)"for the geometry and"SRID=4326;POINT(1 2)"for the geography (recorded: "the geometry type", "the geography type").ST_ASTEXTgives"POINT(1 2)"for both.- A column of NULL has
type_textVOIDandtype_nameNULL, as inSELECT NULL AS n(recorded: "a statement with the format CSV and the disposition EXTERNAL_LINKS", where the value is not in the answer). The value inJSON_ARRAYis not recorded. - A NULL is JSON
nullin every scalar and complex type (recorded: "a NULL of each scalar type", "a NULL of each complex type"). No value is missing from a row, because each row has one cell for each column. - Types that models named and no recording settles:
TIME,CHAR(n),VARCHAR(n),OBJECT(source: Gemini namedTIME,CHARandVARCHAR, and DeepSeek namedOBJECTand said thatTIMEis not supported, not measured), and the type of a vector or of an enum. Documentation namesCHARandUSER_DEFINED_TYPEandTABLE_TYPEas values oftype_name(not measured, source: documentation). databricks-sql-gov1.16.0 scansTINYINT,SMALLINT,INTandBIGINTasint8,int16,int32andint64,FLOATasfloat32,DATEandTIMESTAMPastime.Time, andDECIMAL,BINARY,ARRAY,MAPandSTRUCTassql.RawBytes, and anINTERVALasstring(read ofinternal/rows/rows.go, 2026-10-10).
The mapping is in the table below. The table was written by hand for step 8a, and TestTables
generates it from the code now. Ken decided the mapping in D193 items 6 and 7. A column type that this table does not
name, such as CHAR(n), VARCHAR(n) or TIME, reads as a string, which is the text that the server sent.
| Wire type | Kind | Go type | Scan type | Database type | Can be NULL |
|---|---|---|---|---|---|
| TINYINT | integer | int64 |
int64 |
TINYINT |
yes |
| SMALLINT | integer | int64 |
int64 |
SMALLINT |
yes |
| INT | integer | int64 |
int64 |
INT |
yes |
| BIGINT | integer | int64 |
int64 |
BIGINT |
yes |
| FLOAT | float | float64 |
float64 |
FLOAT |
yes |
| DOUBLE | float | float64 |
float64 |
DOUBLE |
yes |
| DECIMAL | decimal | *apd.Decimal |
*apd.Decimal |
DECIMAL |
yes |
| BOOLEAN | boolean | bool |
bool |
BOOLEAN |
yes |
| STRING | string | string |
string |
STRING |
yes |
| BINARY | binary | []byte |
[]uint8 |
BINARY |
yes |
| DATE | date | dbimp.Date |
dbimp.Date |
DATE |
yes |
| TIMESTAMP | timestamp | time.Time |
time.Time |
TIMESTAMP |
yes |
| TIMESTAMP_NTZ | local timestamp | dbimp.LocalDateTime |
dbimp.LocalDateTime |
TIMESTAMP_NTZ |
yes |
| INTERVAL YEAR TO MONTH | interval | dbimp.Interval |
dbimp.Interval |
INTERVAL |
yes |
| INTERVAL DAY TO SECOND | interval | dbimp.Interval |
dbimp.Interval |
INTERVAL |
yes |
| ARRAY | array | []any |
[]interface {} |
ARRAY |
yes |
| MAP | map | map[string]any |
map[string]interface {} |
MAP |
yes |
| STRUCT | map | map[string]any |
map[string]interface {} |
STRUCT |
yes |
| VARIANT | json | the decoded JSON value |
interface {} |
VARIANT |
yes |
| GEOMETRY | geometry | string |
string |
GEOMETRY |
yes |
| GEOGRAPHY | geometry | string |
string |
GEOGRAPHY |
yes |
| VOID | null | nil |
interface {} |
VOID |
yes |
Notes on the mapping, which step 9 must settle:
- Each value arrives as text, so every type needs a reader of text. An error in the text is an error of the row (D135).
FLOAThas the text of a 32 bit value. The kind float givesfloat64, so0.1is read as thefloat64nearest to the text, and not as thefloat32widened. Both are choices for step 9.NaN,Infinityand-Infinityneed a reader that takes them, andstrconv.ParseFloatdoes.- Decided, D193: the driver accepts three digits.
TIMESTAMPandTIMESTAMP_NTZhave three digits of fraction inJSON_ARRAY, so a value with microseconds loses them in the server before the driver sees them. The Go types hold nanoseconds. A column in a stored table keeps the microseconds on the server (recorded: "the rows of every type" shows the stored value was cut in the answer, and the statement that stored it had six digits). - Decided, D193: both interval types are a
dbimp.Interval. A year to month interval has months only, and a day to second interval has days and nanoseconds. The typesINTERVAL YEAR,INTERVAL MONTH,INTERVAL DAY,INTERVAL HOUR,INTERVAL MINUTEandINTERVAL SECONDhave their owntype_interval_typeand the same kind. - A
DECIMALhas up to 38 digits, so*apd.Decimalholds every value (D33). MAPhas keys of any type, and the text has text keys, so the key type of a map ofINTis lost, and the keys of a map ofBINARYstay base64 text.- Decided, D193: a
STRUCTis amap[string]any, aMAPis amap[string]anythat loses its key type, and anARRAYis a[]any. The driver parsestype_textto decode them. A struct with two fields of one name is not recorded. - Every leaf of an
ARRAY,MAPorSTRUCTis text, so the driver must parsetype_text(ARRAY<STRUCT<a: MAP<STRING, ARRAY<INT>> NOT NULL>>) and decode each leaf by its type. The grammar has a space after a comma,:between a name and a type, andNOT NULL. VARIANTis decoded JSON with real numbers, so a number goes throughdbimp.Number(D19). AVARIANTthat holds a JSON null and a SQL NULL both becomenil, and the kind json cannot tell them apart. Decided, D193: both arenil(D18).GEOMETRYandGEOGRAPHYare text with a different form for the SRID, and the kind geometry leaves the Go type to the decision of the driver. The table givesstring, as Databend does.VOIDis the type of a bareNULL, and the value of such a column is not recorded inJSON_ARRAY.- A column has no nullability, so the table says
yesfor every type.
The server binds parameters. The request carries parameters, a list of objects with name,
value and type.
- A named marker is
:namein the text, and the parameter has the samename. Two parameters worked, and one name can be used twice in the text (recorded: "two parameters", "a parameter used twice"). A marker with no parameter makes the statement fail with the errorUNBOUND_SQL_PARAMETERand the state42P02(recorded: "a marker with no parameter"). A parameter with no marker is ignored (recorded: "a parameter with no marker"). The same name twice makes the statement fail withINVALID_PARAMETER_MARKER_VALUE.DUPLICATE_NAME(recorded: "a parameter with the same name twice"). - A positional marker is
?, and its parameter has noname(recorded: "a positional marker"). A mix of named and positional markers is not recorded. valueis text.typeis the SQL type as text. With notype, the type isSTRING(recorded: "a parameter with no type", wheretypeofansweredstring).- These types were accepted, and the server kept the type (recorded: "a parameter of the type STRING", "a parameter of the type INT", "a parameter of the type BIGINT", "a
parameter of the type FLOAT", "a parameter of the type DOUBLE", "a parameter of the type DECIMAL", "a parameter of the
type DECIMAL with 38 digits", "a parameter of the type BOOLEAN", "a parameter of the type DATE", "a parameter of the
type TIMESTAMP", "a parameter of the type TIMESTAMP_NTZ", "a parameter of the type INTERVAL DAY TO SECOND", "a
parameter of the type INTERVAL YEAR TO MONTH"). The type
DECIMAL(10,2)with the value1.50gavedecimal(3,2), so the server takes the precision from the value (recorded: "a parameter of the type DECIMAL"). ADECIMAL(38,18)kept its 38 digits (recorded: "a parameter of the type DECIMAL with 38 digits"). ATIMESTAMPparameter with microseconds came back with milliseconds (recorded: "a parameter of the type TIMESTAMP"), as a column does. - These types were refused with the state
FAILEDandINVALID_PARAMETER_MARKER_VALUE.INVALID_DATA_TYPE:BINARY,ARRAY<INT>,MAP<STRING,INT>,STRUCT<a:INT>and a type that does not exist (recorded: "a parameter of the type BINARY", "a parameter of the type ARRAY", "a parameter of the type MAP", "a parameter of the type STRUCT", "a parameter of a type that does not exist").databricks-sql-gosends none of them either (read ofparameters.go, 2026-10-10). - A
VARIANTparameter with the value{"a":1}came back as"{"and the typevariant, so the server read the text as a string and the answer is not the value (recorded: "a parameter of the type VARIANT"). It is a fault of the server. - A NULL is a parameter with
valueofnullor with novalue, and atype(recorded: "a parameter with the value NULL as a JSON null", "a parameter with no value"). A parameter with notypeand novalueis not recorded. - A value that does not fit its type fails the statement with
INVALID_VALUE_FOR_DATA_TYPEand the state22023(recorded: "a parameter that does not fit its type"). A quote, a semicolon and a comment in a string value stayed a value (recorded: "a parameter with a quote and a semicolon in the value"). - A marker can stand for a value in a
WHEREand in anINSERT(recorded: "a marker in a where clause", "a marker in an insert"). A marker as an identifier works throughIDENTIFIER(:t), with aSTRINGparameter that holds the name (recorded: "a marker as an identifier"). - An empty list of parameters is accepted (recorded: "a parameter list that is empty"). - The server binds both kinds of marker, so the parser for placeholders of D34 is not needed.
- There is no session. A fresh session answers each request, and nothing set in it reaches the next
request (recorded: "the division by zero with the ansi mode off, in the next request", "the time zone
in the next request", "the schema in the next request", "the catalog in the next request", "the temporary view in the
next request", "the variable in the next request"). The statements
SET ansi_mode,SET TIME ZONE,USE SCHEMA,USE CATALOG,CREATE TEMPORARY VIEWandDECLARE VARIABLEeach succeeded alone (recorded: "a set of the ansi mode", "a set of the time zone", "a use schema", "a use catalog", "a temporary view in one request", "a declared variable in one request"), andSETanswers one row withkeyandvalue. The body that the server accepted has no member for a session (recorded: "a statement with every optional member"). The server ignores a member that does not exist (recorded: "a member that does not exist"), so no recording shows that a member for a session is absent. The history of queries shows asession_idfor each statement, and this work did not try to send it (recorded: "the history of queries"). - A
SETof a configuration that the warehouse does not allow fails withCONFIG_NOT_AVAILABLE(recorded: "a set of a configuration"). - A transaction does not last across requests.
BEGIN TRANSACTIONsucceeded in one request andCOMMITin the next failed withNO_ACTIVE_TRANSACTION(recorded: "a begin transaction", "a commit").ROLLBACKsucceeded with nothing to roll back (recorded: "a rollback").START TRANSACTIONis not valid (recorded: "a start transaction"). A bareBEGINis a syntax error, becauseBEGINopens a script block (recorded: "a begin").SET AUTOCOMMIT = falsesucceeded with no effect that the recordings show (recorded: "a set of autocommit"). - A script can hold
BEGIN ATOMIC ... END. It failed for a table that does not have the table featurecatalogManaged, withTRANSACTION_NOT_SUPPORTED.WRITE_NON_CATALOG_MANAGED_TABLE(recorded: "a begin atomic"). A script that holdsBEGIN TRANSACTION,COMMITorROLLBACKfails withTRANSACTION_NOT_SUPPORTED.SQL_SCRIPT_TRANSACTION_COMMANDand the message that namesBEGIN ATOMIC(recorded: "a script that begins a transaction", "a script that rolls back"). WhetherBEGIN ATOMICworks on a table with the feature is not measured. - So a driver has no transaction.
BeginTxcan return the error that D20 names. The one atomic unit is a script ofBEGIN ATOMIC ... END, which is one statement, and it needs a table of Unity Catalog with the feature (not measured on such a table). databricks-sql-gov1.16.0 hasBeginandBeginTxthat returnErrNotImplemented. Its repository holds a design document for transactions with the status "in review" (read ofconnection.goandDESIGN_MULTI_STATEMENT_TRANSACTIONS.md, 2026-10-10).- A DML statement took effect when its request ended (recorded: "an insert and its answer", "a select of the rows").
- A statement that fails in the engine is HTTP 200 with the state
FAILED. The error is instatus.error, and the state of SQL is instatus.sql_state:{"status":{"state":"FAILED","error":{"error_code":"BAD_REQUEST","message":"..."},"sql_state":"42601"}}(recorded: "a syntax error"). Theerror_codewasBAD_REQUESTfor all 53 failed statements, whatever the cause. A driver must readsql_stateand the text of the message. - A statement that is
PENDINGcan fail later, so the error can arrive in a later read (recorded: "an error with a wait timeout of 0s", "the failed statement of the wait timeout of 0s, after 5s"). A failed statement read again gives the same error (recorded: "a failed statement that is read again", "the failed statement, read again"). - The message has the name of the error in brackets and the state, such as
[PARSE_SYNTAX_ERROR] Syntax error at or near 'SELEC'. SQLSTATE: 42601 (line 1, pos 0), with a copy of the statement and the position after it. These are the errors recorded, with their state:PARSE_SYNTAX_ERROR,42601, andPARSE_EMPTY_STATEMENT,42617(recorded: "a syntax error", "an empty statement").TABLE_OR_VIEW_NOT_FOUND,42P01(recorded: "a table that does not exist").UNRESOLVED_COLUMN.WITH_SUGGESTION,42703(recorded: "a column that does not exist").UNRESOLVED_ROUTINE,42883(recorded: "a function that does not exist").DIVIDE_BY_ZERO,22012,ARITHMETIC_OVERFLOW,22003, andCAST_INVALID_INPUT,22018(recorded: "a division by zero", "an overflow of an integer", "a cast of text to an integer"). The messages nameansi_modeandtry_cast.TABLE_OR_VIEW_ALREADY_EXISTS,42P07(recorded: "a duplicate table").USER_RAISED_EXCEPTION,P0001(recorded: "a raised error").NOT_SUPPORTED_WITH_DB_SQL,0A000, forjava_method(recorded: "the statement that sleeps, at once").INSUFFICIENT_PERMISSIONS,42501, and a message that startsPERMISSION_DENIED:with the same state (recorded: "a create table in the schema of another user", "a create schema", "show tables in the schema of another user").
- An error after some rows: the statement fails as a whole, and no rows arrive. A division by zero in
the sixth row of 10 and one in the last row of 3000 both gave
FAILEDand nomanifest(recorded: "a division by zero after some rows", "an error in the middle of a large result"). So the driver has no error after some rows in the inline form. - HTTP statuses before a statement runs:
- 400 with
error_codeas text,message, anddetailsthat name the field or therequest_id:INVALID_PARAMETER_VALUE(a wait timeout, a chunk out of bounds, a row limit, a byte limit, a warehouse id, a statement id, a disposition with a format),BAD_REQUEST(a field that is required) andMALFORMED_REQUESTfor a body that is not JSON, with the message "Invalid JSON given in the body of the request- failed to parse given JSON" (recorded: "a body that is not JSON").
- 403 with
PERMISSION_DENIEDfor a warehouse that the principal cannot use and for the configuration of the warehouses (recorded: "a missing warehouse", "the configuration of the warehouses"). - 403 for a wrong token, with the body
{"error_code":403,"message":"Invalid access token. [ReqId: ...]"}, and the headerX-Databricks-Reason-Phrase: Invalid access token.(recorded: "a statement with a wrong token", "a read of a statement with a wrong token", "a cancel with a wrong token", "the warehouse with a wrong token"). The status is not 401, anderror_codeis a JSON number here and a text everywhere else. A decoder must accept both. - 404 with
NOT_FOUNDfor a statement or a result that is not known, withdetailsthat give the resource (recorded: "a statement id that does not exist", "a chunk of a statement that does not exist"), and 404 withENDPOINT_NOT_FOUNDfor a path or a method that the API lacks.
- 400 with
- A limit on the rate of requests, and HTTP 429 or 503, did not appear. The script sent its requests one at a time. The behavior at a limit is not measured.
- Which errors mean that the request did not reach the server: a refusal of the connection or of the TLS
handshake before any byte of the request was written (not measured: no recording holds a connection error). An
HTTP status means that the server read the request. A statement that is
PENDINGwas accepted, so a driver must not send it again. - The error of a read of a statement that has
CANCELEDis not an error object. The state is the only sign (recorded: "the canceled statement, after 3s").
errors.Is(err, dbimp.ErrAuthentication) is true for an Error with HTTP 401,
and for an Error with HTTP 403 whose message starts with Invalid access token. The workspace answers a wrong token with HTTP 403 and the number 403 as
error_code. The recorded cases are "a statement with a wrong token", "a read of
a statement with a wrong token", "a cancel with a wrong token" and "the
warehouse with a wrong token". No recording holds HTTP 401, so the unit test
builds it.
The match is false for any other HTTP 403, such as PERMISSION_DENIED (recorded:
a SQL warehouse that the user cannot use, and the configuration of the
warehouses). It is false for a statement that ended in the state FAILED, even
when its message names PERMISSION_DENIED, and for every other error.
errors.Is also finds the match through a wrapped error and through
errors.Join.
- A statement can wait on the server. With
wait_timeoutof"0s"the answer is at once with the statePENDING, and a laterGETgives the result (recorded: "a statement with a wait timeout of 0s", "the statement of the wait timeout of 0s, at once", "the statement of the wait timeout of 0s, after 5s"). With"5s"to"50s"the call waits until the statement ends or the time passes (recorded: "a statement with a wait timeout of 5s", "a statement with a wait timeout of 50s"). The call that was recorded for the first statement waited about 15 seconds, within the 50 (recorded: "setup: warm the warehouse"). - What happens when the wait passes and the statement is still running:
on_wait_timeoutisCONTINUEby default, orCANCEL. Both statements that the script sent for this finished within 5 seconds, so the answer wasSUCCEEDEDfor both and the cases are not measured (recorded: "a heavy statement with a wait timeout of 5s and CANCEL", "a heavy statement with a wait timeout of 5s and CONTINUE"). Documentation says thatCANCELcancels the statement when the wait ends andCONTINUElets it run (not measured, source: documentation). - A poll is
GET /api/2.0/sql/statements/{id}. The call answers at once and does not wait (recorded: "the statement of the wait timeout of 0s, at once"). The documentation has no query parameter for a wait on a read (not measured, source: documentation), so a driver polls with a delay. - A cancel is
POST /api/2.0/sql/statements/{id}/cancel. It answers HTTP 200 and{}for a statement that runs, for a statement that finished, and for an id that does not exist (recorded: "a cancel of the heavy statement", "a cancel of a statement that is finished", "a cancel of a statement that does not exist"). The statement wasCANCELEDafter 3 seconds (recorded: "the canceled statement, after 3s"). A cancel of a finished statement left itSUCCEEDED(recorded: "the first statement after 16 minutes", a read of the statement that "a cancel of a statement that is finished" cancelled). A cancel of a statement that wasPENDINGat once worked, and a cancel of one that isRUNNINGis not recorded, because the statements that the script made ended too soon. - What the server does when the client leaves: a statement sent with
wait_timeoutof"0s"runs to its end with no client attached (recorded: "the statement of the wait timeout of 0s, after 5s"). What a statement with a wait of"50s"does when the client closes the connection is not recorded. So a driver cancels on the server by its own cancel, as D36 says. - Waking the warehouse: the first statement after the warehouse stopped took 14992 ms by the header
Server-Timing(recorded: "setup: warm the warehouse"), and the first statement after the pause of 16 minutes took 15131 ms (measured: the headerServer-Timingof "teardown: drop view dbimp_t_view", 2026-10-10). The warehouse hasauto_stop_minsof 10 andauto_resumeoftrue(recorded: "the warehouse"). A client that waits at most 50 seconds for a statement waits long enough for this wake. - Statement lifetime: an inline result that was 21 minutes old was still readable (measured: "the first statement
after 16 minutes" is a read at 05:53:14 of the statement made at 05:31:59, 2026-10-10). A read of the
statement and of its chunk 0, 16 minutes after, gave the same rows (recorded: "a statement after 16 minutes",
"the chunk 0 of the statement after 16 minutes"). The end of the life of a statement is not measured, and no
CLOSEDstate was seen. - A read of a statement with external links, 16 minutes after, gave a fresh link (see Responses).
databricks-sql-gohas the optionWithTimeout, a time for a query on the server in seconds, andmaxRowsof 100000 for each fetch (read ofCONNECTION_PARAMETERS.md, 2026-10-10).
- Several statements in one request:
SELECT 1 AS a; SELECT 2 AS bfails withPARSE_SYNTAX_ERRORand the words "extra input 'SELECT'", and twoINSERTstatements run neither (recorded: "two statements in one request", "two statements that change data", "the rows after the two statements"). A script in a block runs:BEGIN DECLARE x INT DEFAULT 1; SET x = x + 1; SELECT x; ENDgave one row with"2", and a block with anINSERTand aSELECTgave the count (recorded: "a script with a compound statement", "a script that changes data"). The answer of a script is the result of its last statement. A script with an error in the middle fails as a whole and returns no earlier rows (recorded: "a script with an error in the middle"). - A trailing semicolon, a line comment first or last, and a block comment are accepted (recorded: "a statement with a
trailing semicolon", "a statement with a trailing semicolon and a comment", "a statement with a line comment first", "a
statement with a line comment last", "a statement with a block comment"). A statement that is only a comment, only a
semicolon, or only white space fails with a syntax error or
PARSE_EMPTY_STATEMENT(recorded: "a statement that is only a comment", "a statement that is only a semicolon", "a statement that is only white space"). - The count of rows of a DML statement is a row of the result, and the column names depend on the statement:
INSERTgivesnum_affected_rowsandnum_inserted_rows, bothBIGINT, as text (recorded: "an insert and its answer", "an insert from a select").UPDATEandDELETEgivenum_affected_rowsonly (recorded: "an update and its answer", "a delete and its answer").MERGEgivesnum_affected_rows,num_updated_rows,num_deleted_rowsandnum_inserted_rows(recorded: "a merge and its answer"), where the row was["2","1","0","1"].TRUNCATE,CREATE TABLE,CREATE VIEW,ALTER TABLEandDROPgive no column and no row (recorded: "a truncate", "a create table of Delta", "a create view", "an alter table that adds a column").CREATE TABLE AS SELECTnames the two columns ofINSERT, and gives no row, so the count is not known (recorded: "a create table as select").- The answer does not say that the statement was DML. A
SELECT 1 AS num_affected_rowshas the same shape, so a driver that must tell the two apart reads the first word of the statement, or the history of queries, which names astatement_type(recorded: "the history of queries"). - The count of an update that matched no row is not recorded.
- There is no id of the last row inserted. A column
GENERATED ALWAYS AS IDENTITYgives values 1 and 2 (recorded: "the rows of the table with an identity column"). - The statements that the script ran, each one alone:
CREATE TABLE ... USING DELTA,CREATE TABLE AS SELECT,CREATE VIEW,DROP VIEW,ALTER TABLE ADD COLUMN, andALTER TABLE RENAME TO(recorded: "a create table of Delta", "a create table as select", "a create view", "a drop of the view", "an alter table that adds a column", "an alter table that renames the table").ALTER TABLE RENAME COLUMNandDROP COLUMNneed the table propertydelta.columnMapping.modeset tonamefirst, and then they work (recorded: "an alter table that renames a column", "an alter table that renames a column after the mapping", "an alter table that drops a column"). The request that is named "an alter table that renames a column" holds theSET TBLPROPERTIESstatement, and it succeeded. The script then sent the rename.- A primary key and a foreign key are accepted, and neither one is enforced: two rows with one key and a
key that has no parent both went in (recorded: "a create table with a primary key", "a create table with a foreign
key", "an insert of a duplicate primary key", "an insert of a foreign key that has no row"). The constraints show
in
information_schema.table_constraintsandkey_column_usage(recorded: "the constraints of the tables", "the key columns of the foreign key"). - A generated column, an identity column, a default (with the table property
delta.feature.allowColumnDefaults) and a SQL function work (recorded: "a create table with a generated column", "a create table with an identity column", "a create table with a default", "a call of the function"). A table function with a parameter failed for a reason of the body (recorded: "a create function that returns a table"), so table functions are not settled. EXPLAINgives rows of text, one for each line (recorded: "an explain").DESCRIBE HISTORYfailed because the table had been renamed first, so it is not settled (recorded: "the history of the table").
- INFORMATION_SCHEMA and SHOW:
workspace.information_schemahasschemata,tables,columns,table_constraintsandkey_column_usage, and each one answered (recorded: "the schemata", "the tables in information_schema", "the columns in information_schema", "the constraints in information_schema", "the constraints of the tables").columnshasordinal_positionfrom 0,is_nullableasYES,data_typeandfull_data_typeas text, andnumeric_precisionandnumeric_scaleas NULL for a type with none (recorded: "the columns in information_schema").SHOW CATALOGSgives the columncatalog,SHOW SCHEMAS IN workspacegivesdatabaseName,SHOW TABLES IN workspace.dbimpgivesdatabase,tableNameandisTemporary,DESCRIBE TABLEgivescol_name,data_typeandcomment, andSHOW CREATE TABLEgives one cellcreatetab_stmt(recorded: "show catalogs", "show schemas", "show tables", "describe table", "show create table").SHOW CATALOGSnamedsamples,systemandworkspace.- The version:
SELECT version()gives one row and one column with the text4.2.0 <hash>(recorded: "the version"). D181 item 1 says a product with a query for its release gets no support of the driver.
- The statement
SELECT current_catalog(), current_schema(), current_database()gaveworkspace,dbimp,dbimpfor the request that set both members (recorded: "the catalog and the schema"). - Unity Catalog has three levels: catalog, schema, table.
current_database()is the schema (recorded: "the catalog and the schema").
- The script has one login: a personal access token of one service principal. The principal owns the schema
dbimpin the catalogworkspace, and holdsUSE CATALOGon the catalog only (recorded: "the schemata", whereschema_ownerofdbimpis the principal).dbrunmakes no ordinary user for a hosted service, and the manifest says so innoOrdinaryUser. Every recording is of that login. - What the principal can do: read and write its own schema, create and drop tables, views and functions in it, use the warehouse, and call the warehouse API and the Unity Catalog API for reading (recorded: "a create table of Delta", "an insert and its answer", "a create view", "a create function", "the warehouse", "the list of tables in Unity Catalog").
- What it cannot do:
- Browse a schema of another owner:
SHOW TABLES IN workspace.dbmetafails withPERMISSION_DENIED: User does not have BROWSE on Catalog 'workspace'.(recorded: "show tables in the schema of another user"). - A read of a table of that schema fails with
TABLE_OR_VIEW_NOT_FOUND, as if it did not exist, so the server does not tell that the schema exists (recorded: "a select from the schema of another user"). - Create a table there:
INSUFFICIENT_PERMISSIONS,USE SCHEMA(recorded: "a create table in the schema of another user"). Create a schema:PERMISSION_DENIED,CREATE SCHEMA(recorded: "a create schema"). - Read the configuration of the warehouses: HTTP 403 (recorded: "the configuration of the warehouses").
- Browse a schema of another owner:
- The version is open to the principal (recorded: "the version").
usqlruns no statement for the version on this driver, becauseusqlregisters it with an error hook only (read ofusql/drivers/databricks/databricks.go, 2026-10-10). So the statement thatusqlruns is none. The statement that a person would run isSELECT version(), and it answers4.2.0and the build hash to the one login that was recorded. There is no ordinary user to compare with, because the manifest says that a hosted workspace has one login for this work. The driver gives no answer of its own toSELECT version(), and the server answers it (D181 andTestReplayVersion). The requests todburl,dbmetaandusqlare written in W39 of BACKLOG.md. Nothing is sent. - A principal that has no right to use the warehouse gets HTTP 403 (recorded: "a missing warehouse").
- A personal access token is the only credential that was sent. The token of a service principal for OAuth has
all-apisas its scope (not measured, source: documentation).
None. The API is one service. Databricks on AWS, on Azure and on Google Cloud use the same API with a different host (see The DSN), and only AWS was measured. A host on Azure or Google Cloud is not measured.
The table is generated from the code of databricks/ by TestTables. Run the test with
DBIMP_UPDATE=1 to write it. Each row says whether the driver implements the interface, and why.
| Interface | Implemented | Reason |
|---|---|---|
driver.DriverContext |
yes | OpenConnector parses the DSN once, for every connection. |
driver.Connector |
yes | The connector owns the transport, which every connection shares, and sends the token of the DSN as a Bearer token to the host of the DSN only (D193). |
io.Closer on the connector |
yes | Close closes the idle connections of the transport. |
driver.Pinger |
yes | Ping runs SELECT 1, which checks the token and the warehouse, and wakes a warehouse that stopped. It costs little. |
driver.SessionResetter |
no | A connection holds nothing on the server, because each request is its own session (measured). |
driver.Validator |
no | A connection holds nothing on the server, so it is always valid. |
driver.NamedValueChecker |
yes | It keeps an Option, and the values that the driver binds with a type of their own: a decimal, a dbimp.Date, a dbimp.LocalDateTime, a dbimp.Interval, and a list and a map that fail with dbimp.ErrArguments (D193). |
driver.QueryerContext |
yes | The statement goes to POST /api/2.0/sql/statements with its arguments as typed parameters, which the server binds to its ? and its :name (D193). |
driver.ExecerContext |
yes | Exec reads the row of num_affected_rows, and RowsAffected is its value, or an error that wraps dbimp.ErrNotSupported when the answer has no such row (D178 and D193). |
driver.ConnPrepareContext |
yes | A prepared statement runs as its text, with its arguments, each time. |
driver.ConnBeginTx |
yes | BeginTx fails with dbimp.ErrNotSupported, because the API has no session and a transaction does not last across requests (D20 and D193). |
driver.RowsColumnScanner |
yes | A value is decoded when its row is read, and assigned when it is scanned. |
driver.RowsNextResultSet |
no | A request holds one statement, so an answer has one result. A script answers with the result of its last statement. |
driver.RowsColumnTypeScanType |
yes | The manifest names the type of each column in type_text, and each type has one Go type (D135 and D193). |
driver.RowsColumnTypeDatabaseTypeName |
yes | The name of the type in upper case, with no parameters, such as DECIMAL. Each interval reports INTERVAL. |
driver.RowsColumnTypeLength |
no | The manifest has no length for a string or a binary column (measured). |
driver.RowsColumnTypeNullable |
yes | The manifest has no nullability, so every column can be NULL and the second result is false (measured). |
driver.RowsColumnTypePrecisionScale |
yes | A DECIMAL column has its precision and its scale in the manifest. |
The faults of github.com/databricks/databricks-sql-go v1.16.0, which this driver must not repeat (read of the
source in the module cache, 2026-10-10):
BeginandBeginTxreturnErrNotImplemented, withcontext.TODO()in the error. This driver must return the error that D20 names, with the context of the caller.LastInsertIdalways returns 0, andRowsAffectedreturns the field that the server gave. A caller cannot tell a count of 0 from an unknown count.- A column of
TINYINT,SMALLINTandINTscans asint8,int16andint32, and aFLOATasfloat32. D135 givesint64andfloat64. ADECIMAL, aBINARY, anARRAY, aMAPand aSTRUCTscan assql.RawBytes, and anINTERVALasstring. The decimal is a text and not a number. ColumnTypeNullablereturnsfalse, falsefor every column, and the manifest of the REST API has no nullability either.- The parameter of a Go
intgoes asINT, and auint64goes asBIGINT, so a large value wraps or fails. Atime.Timegoes asTIMESTAMPin RFC 3339 text. A[]bytegoes as aSTRINGof its bytes with the verb%s, because the server refuses aBINARYparameter. A value of another type goes as text with%s. - The default backend is Thrift over HTTP with Arrow batches, and a second backend needs Rust libraries that the
build tag
databricks_kernelpulls in (read ofCONNECTION_PARAMETERS.md). The module needs Arrow, which is the cost thatusqllists. - The driver opens a session on the server for each connection, so a
SETand aUSElast for the connection. ItsResetSessionreturnsniland does nothing, so state that one caller set stays for the next caller that gets the connection from the pool. This driver has no session (see Transactions). ItsPingrunsselect 1. maxRowsof 100000 is a client setting for the size of each fetch, and a driver here has no such setting (see Responses).usqlhas noVersionstatement and no hook for Databricks, except an error hook.- The warehouse has faults of its own that the sections above list: the timestamp text with three digits, a
VARIANTparameter that comes back as"{", a primary key that is not enforced, anerror_codeof 403 as a number for a wrong token, and theerror_codeofBAD_REQUESTfor every failed statement.
- Gemini (
gemini-3.1-pro-preview, 2026-10-10) was asked the four questions of step 5a. It named the statements of CRUD, the schema features, the features and the types thatfeatures.jsonholds. It said that a primary key, a foreign key and a unique constraint are informational and not enforced, which the server showed for the first two (recorded: "an insert of a duplicate primary key", "an insert of a foreign key that has no row"). It named aTIMEtype and said that it was unsure whether a column can have it. It said that parameter markers are named:paramand positional?, which the server confirmed. It said thatCHAR(n)hasnup to 255 and thatVARCHAR(n)goes to a billion characters, which is not measured. - DeepSeek (
deepseek-v4-flash, 2026-10-10) was asked the same four questions. It gave the same operations, and it listedQUALIFY,table_changes,read_files,OPTIMIZE,VACUUMand the AI functions. It said thatTIMEis not supported and thatOBJECTis unknown, and it said that a unique constraint and a default value were uncertain. The server accepted a default value on a table with a property (recorded: "a create table with a default"). It also said that a parameter marker?was uncertain, and the server accepted it (recorded: "a positional marker"). deepseek-v4-pro,kimi-k3,kimi-k2.7-code,qwen-maxandqwentimed out on every try on 2026-10-10, anddeepseek-v4-profirst used its whole budget of tokens for its thinking, so they gave no answer.deepseek-v4-flashneeded a budget of 20000 tokens.github.com/databricks/databricks-sql-gov1.16.0 was read on 2026-10-10 in the module cache. No driver in another language was read (the Python connector, the JDBC driver and the Go SDK were not), so the survey has no client in another language. The reference of the API stands in for it, as it did for Snowflake and BigQuery.- Gemini (2026-10-10) was asked what step 6 did not find. It gave these leads, and the server said:
- Cancel with
POST .../cancel, poll withGET, fetchchunks/1, seton_wait_timeouttoCANCEL, and setrow_limitandbyte_limit. All were recorded, and the chunk 1 does not exist for a result of one chunk (recorded: "a cancel of the heavy statement", "the chunk 1 of the 3000 rows", "3000 rows with the row limit 10", "3000 rows with the byte limit 1000"). The cases ofon_wait_timeoutended before the wait (see Cancellation and timeouts). - Force a result of several chunks with
SELECT repeat('A', 10000) FROM range(2000), which is 20 MB, and Gemini said that the limit of INLINE is 16 MB. The recordings show the byte limit of 25 MiB for the request (recorded: "3 rows with the byte limit 0"). The lead is not sent. A result above 25 MiB needs a statement of about 30 MB. - Send two statements in one request, and see whether it fails: it fails (recorded: "two statements in one request").
- The NULL, NaN, Infinity, decimal, interval and timestamp text: all were recorded (recorded: "a NULL of each scalar type", "the special floating point values of DOUBLE", "the longest decimals", "the interval year to month types", "the timestamp type").
- A statement with zero rows: recorded (recorded: "columns of a result with no rows").
- A limit on the size of the request, which answers HTTP 413 for a statement of 10 MB. Not sent, and not measured.
- Cancel with
- DeepSeek (2026-10-10) was asked the same question. It gave these leads that the script sent: the combinations of
formatanddisposition, the parameter types, the refusals ofBINARY,ARRAY,MAPandSTRUCT(it was right), the warehouses endpoint and the history endpoint,catalogandschema, and the text ofINTERVAL,VARIANT,GEOMETRY,GEOGRAPHYandBINARY(it said "likely" and was right). It gave leads that nothing has sent:SELECT * FROM t VERSION AS OF 123for time travel,CREATE TABLE t SHALLOW CLONE srcfor a clone,SELECT v:field::string FROM tfor a path ofVARIANT, andSELECT ... |> WHERE ...for pipe syntax.next_chunk_indexandnext_chunk_internal_linkof a result of several chunks.- A request member
idempotency_key, which the documentation does not have as far as the agent knows. The server ignores a member that does not exist (recorded: "a member that does not exist"), so a test cannot tell. - HTTP 429.
TIME,UUID,JSONandOBJECTas native types. Each of these stays "not measured", with the model that gave it.
- The leads of this work, which the second live pass must send (see Open questions):
- A result of more than one chunk, with
next_chunk_indexandnext_chunk_internal_link, for each disposition. - The body of a presigned link of
JSON_ARRAY, fetched with noAuthorizationheader, and the text of a timestamp in it. - A statement that stays
RUNNINGfor more than 10 seconds (for example a cross join of 200000 rows with itself, orSELECT count(*) FROM range(1000000000)with a hash), to readRUNNING, a wait that passes withCONTINUEand withCANCEL, and a cancel of a running statement. - A catalog or a schema that does not exist in the body, with
SELECT current_schema(). - A column of
CHAR(n),VARCHAR(n)and a typeTIME, in a table, to see thetype_nameand the text. - The value of
SELECT NULL AS ninJSON_ARRAY. - A
BEGIN ATOMICscript on a table with the table featurecatalogManaged. OAuthmachine to machine at/oidc/v1/tokenwithscope=all-apis.- The Azure and Google Cloud hosts.
INSERT OVERWRITE,COPY INTO,REPLACE WHERE,CHECKand a unique constraint,OPTIMIZE,VACUUM,RESTORE, time travel,SHALLOW CLONE, a path ofVARIANT,QUALIFY, pipe syntax, a materialized view, a streaming table, partitioning and clustering, and an index: none was sent.DESCRIBE HISTORYon a table that is not renamed, and a table function with a body that the server accepts.CREATE SCHEMAas a principal that can create one, to settle the feature, because the refusal recorded is a privilege refusal.- The effect of
query_tags(the member of the history of queries namedquery_tagswas empty). - A
VARIANTparameter from aSTRINGwithparse_json(:p), and aBINARYthroughunhex(:p). - A DML statement that changes no row, and
CREATE TABLE AS SELECTwith the count. - A limit on the rate, HTTP 429.
- The end of the life of a statement, and a
CLOSEDstate. - A mix of named and positional markers.
- A result of more than one chunk, with
- Gemini (
gemini-3.1-pro-preview, 2026-10-10) and DeepSeek (deepseek-v4-flash, 2026-10-10) each reviewed the type mapping of step 8a in their own conversation, from the kinds ofTYPES.md, D135 and the text that the server sent. The first Gemini call and the second one closed the connection once each, and the answer was cut by its token budget after the item forMAP, so its review has two parts:- Both said that
INTERVAL DAY TO SECONDis a mistake astime.Duration, and that it must be adbimp.Intervalwith days and nanoseconds, because a day can differ in length and becausetime.Durationoverflows above about 292 years. They were told only the shape of the text. When Gemini was told that Spark stores a day to second interval as an exact count of microseconds, so a day is 24 hours, it said that this changes its view, and that the type then measures an absolute duration. That fact is not measured here (source: Gemini and the Spark documentation as the agent knows it). Decided, D193: the mapping is adbimp.Interval. - DeepSeek said that a
VARIANTthat holds a JSON null and a SQL NULL must not both becomenil, and that a number in aVARIANTmust not go through afloat64. The mapping already decodes the number withdbimp.Number(D19), as the kind json says, and the JSON null is nil, as a SQL NULL is (D18, D193 item 7). It said that the parser oftype_textmust stripNOT NULL, that the key type of aMAPis lost and cannot be recovered with amap[string]any, that the SRID of aGEOGRAPHYmust be kept or stripped by a decision, thatstrconv.ParseFloattakesInfinity, that aBINARYis base64 to decode, and that the lost microseconds of aTIMESTAMPcannot be recovered by any mapping. It found no other kind wrong. - Gemini, in its second part, gave a definition of each remaining type and found no fault in
ARRAY,STRUCT,VARIANT,GEOMETRY,GEOGRAPHY,TIMESTAMP,FLOAT,VOIDandBINARY. In the first part it said that the leaves of aMAPmust be decoded by their type fromtype_text, which the notes say. - The two reviewers are of two vendors, Google and DeepSeek. Neither one saw the recordings, so neither one tested a claim about the server.
- Both said that
Ken decided the step 9 items on 2026-10-10, in D193, and he accepted the choices of the package on 2026-10-11 (D193 item 12). The first six lines are the answers of D193. Questions 1, 2, 5 to 9, 11, 12 and 14 are decided. Questions 3, 4, 10, 13 and 15 are open.
- Decided, D193:
INLINEonly, with an error ontruncatedor on a statement that fails for the size of the result. A later release can addEXTERNAL_LINKSafter a recording of a second chunk and of the body of a link. - Decided, D193: the driver accepts the three fraction digits of
TIMESTAMPandTIMESTAMP_NTZ. A caller who needs microseconds casts to a string in SQL. - Decided, D193: the DSN is
databricks://token:<pat>@host/<warehouse-id>?catalog=&schema=, with the token as the password (D94). OAuth with a client id and a secret can come later. - Decided, D193:
BeginTxreturns the error of D20. The driver sends the catalog and the schema of the DSN with every statement.SET,USE, temporary views and variables do not last between statements. - Decided, D193: several statements go to the server, which answers a parse error. The driver sends
wait_timeoutof 50 seconds and polls.Execreads the count row, andRowsAffectedreturns the wrappeddbimp.ErrNotSupportedwhen there is none. The error type exposes the HTTP status,error_code,sql_stateand the message. The driver gives no answer to a version request (D181), the token goes only to the configured host, and the driver serves no flavor. - Decided, D193: the types are as in the type table.
STRUCTis a map,INTERVALis adbimp.Interval, and aVARIANTwith a JSON null or a SQL NULL givesnil.
- Decided (D193 item 10). R. Databricks is a hosted service with no emulator, so a test needs a workspace and a token. The Free Edition workspace is free and has one warehouse that stops after 10 minutes. The integration tests run only where a person supplies a workspace, and the workflow has no job and no secret for them.
- Decided (D193 item 11). The host.
dburladds.cloud.databricks.comto a host that has no dot. The driver uses HTTPS on port 443, and the keytls=falselets a test use plain HTTP. - Open. The recordings contain presigned link URLs. The main session redacted their signatures. No decision names them.
- Open. The leads for a second live pass, in Second opinions, stay open. The live run of 2026-10-11 ran the integration tests, and no recording or document of the run says which of these leads it sent.
- Decided (the tests ran). The tests that
features.jsonnames exist, indatabricks/features_integration_test.goanddatabricks/roundtrip_integration_test.go. They ran on a workspace on 2026-10-11 and passed (see Integration tests).
The package made these choices where no document answered. Ken accepted the ones that D193 item 12 names. The others stay open, and each one says so:
- Decided (D193 item 12). The type of a NULL parameter. A
nilargument has no Go type, so the driver sends the typeVOID. No recording shows what the server does with it. The other choice isSTRING, which fails for a column of a number under ANSI mode, because a string is not assigned to a number. The live run acceptedVOID(D193 item 12). - Decided (D193 item 12). The wait of a statement. The driver sends
wait_timeoutof 50 seconds. When the context of the caller ends in less than 50 seconds, it sends0sand polls, because the answer holds the id of the statement, and the driver needs the id to cancel the statement. D193 item 8 says 50 seconds and does not name this case. When the context has no deadline, or a long one, the wait is 50 seconds. A context that is canceled with no deadline can still leave a statement that runs on the server, until it ends, because the driver learns the id only from the answer. - Decided (D193 item 12). The key
timeoutand the optionWithTimeoutare the longest time that the driver waits for one statement. The default is none. D193 item 8 says that the default must allow the 15 seconds that a stopped warehouse takes to wake, and no limit allows it. The driver cancels the statement on the server when the time ends. - Decided (D193 item 12).
WithDatabasesets the schema, asWithSchemadoes, because Spark calls a schema a database (recorded: "the catalog and the schema").WithCatalogsets the catalog.WithReadonly(true)fails withdbimp.ErrNotSupported. - Decided (D199 item 2).
WithParametersets a member of the body, and replaces the member of the driver with the same name. It refuseswarehouse_id,statement,parameters,wait_timeout,on_wait_timeout,row_limit,byte_limit,dispositionandformat. Arow_limitor abyte_limitmakes the server cut the result, and D193 item 2 says that the driver returns an error for a result that was cut. - Decided (D193 item 12). The user name of the DSN is
tokenor empty, and the DSN has no other. The path is one name, with or without a slash at its end, and the driver does not check its form, because the server checks it (recorded: "a warehouse id that is not valid"). The keytls=falsemakes the driver use HTTP, for a fake server of a test. - Decided (D193 item 12). A
TIMESTAMPparameter is the instant in UTC, written with at most six digits of fraction, and the driver cuts the nanoseconds. The session zone is UTC (recorded: "the time zone of the session"). An interval parameter fails when it holds months and days together, because Spark has no such interval, and when it holds a part of a microsecond. - Decided (D199 item 3).
ColumnTypeNullablereturnstrueandfalse: the column can be NULL, and the driver does not know. The manifest has no nullability (recorded: "the rows of every type"). - Decided (D193 item 12).
Execof a statement whose answer has the columnnum_affected_rowsreads the whole answer, and returns its first value as the count.Execof any other statement closes the answer at once, and the count is not known. - Decided (D199 item 3). The rows of the driver hold the function that cancels the context of the timeout, and no context, because the driver
polls inside
QueryContextand the statement has ended when the rows exist. So Databricks needs no change in rule 4 ofAGENTS.md.
The integration tests of the driver read DATABRICKS_DSN and skip when it is empty (hard rule 9). The variable holds the
DSN of D193, with the token as the password and the warehouse id as the path:
DATABRICKS_DSN='databricks://token:TOKEN@dbc-XXXXXXXX-XXXX.cloud.databricks.com/WAREHOUSE_ID?catalog=workspace&schema=dbimp'
dbrun does not start Databricks, and the workflow has no job for it and no secret (D193 item 10). A person runs the tests
on a workspace with a login that owns the schema of the DSN, which was the service principal of the recordings:
go test -race -count=1 -run Integration -v ./databricks/...
The login is one service principal, so each test runs as that principal only, and the manifest has no ordinary user. The
tests make their tables, views and functions in the catalog and the schema of the DSN, with the name of the run as the
prefix (dbimp_it_ and eight characters). TestMain looks for an object of the run that a test left, drops it and fails.
The warehouse of the free workspace stops after 10 minutes, so the first statement waits about 15 seconds. The workspace
has a daily quota of compute that dbmeta shares, and the round trip of every type sends about 1500 statements, so a person
runs the tests once a day at most. The tests were written on 2026-10-10 with no workspace. They ran on a free workspace on
2026-10-11 and all of them passed. The only skip in the code is the subtest of the primary key, which skips when the table of
the subtest before it does not exist. The tests and what each one holds:
TestIntegrationConnect: the login,Ping, the version, and the catalog and the schema of a statement and of an option.TestIntegrationErrors: an error of the engine before any row, a statement that fails in its last row, a warehouse that the login cannot use, and a wrong token.TestIntegrationTransactions:BeginTxand aCOMMITafter aBEGIN TRANSACTIONin another request.TestIntegrationContext: a deadline andWithTimeoutthat end while a long statement runs. The driver cancels it.TestIntegrationParameters: each Go type that the driver binds, a NULL in a column of a number, and the refusal of a byte slice, a list and a map.TestIntegrationCRUD,TestIntegrationSchemaandTestIntegrationFeatures: the entries offeatures.json, in the order that the file names them. A feature that the driver does not expose, such as a limit of rows, the format of a result and the cancel of a statement, goes through the REST API with the token of the DSN.TestIntegrationRoundTrip: every type thatfeatures.jsonmarks yes, withdbimptest.RoundTrip, as a bound argument and as a literal. A byte slice, a list, a map, an interval and a geometry cannot go in as a Go value or in a table of Delta, so the test binds text and the statement turns it into the type. TheVOIDtype is a NULL literal that a select reads from a table of text.
These facts had no recording before the live run. The run passed with VOID for a NULL parameter (D193 item 12). This
document holds no other measured result of the run, so the other facts stay "not measured" here until a person records them:
- The type
VOIDfor a NULL parameter, and a NULL parameter inunhex,from_jsonandparse_json. - A date and a timestamp of the year 1 in a table of Delta, which Spark can refuse when it writes to Parquet.
- A cast of the text
INTERVAL '1-2' YEAR TO MONTHback to an interval, which the test uses to store an interval in a column of text. ST_GEOMFROMTEXTandST_GEOGFROMTEXTon the warehouse, and the text of a geography that they return.- The
SHOW USER FUNCTIONSstatement thatTestMainuses to find a function that a test left. - A statement that runs long enough to be canceled while it runs. All 331 recorded statements ended in about 5 seconds.
Step 17a compares this driver with couchbase, the first driver (D97). It was written on 2026-10-10 from the code of the first release.
A fact of Couchbase comes from COUCHBASE.md, and a fact of Databricks from the sections above.
| Couchbase | Databricks | |
|---|---|---|
| Request | POST /query/service, with statement, args and $name |
POST /api/2.0/sql/statements, with warehouse_id, statement, catalog, schema, wait_timeout and parameters (Requests) |
| Database | The key query_context of the body |
The members catalog and schema of the body, and the warehouse in warehouse_id (Requests) |
| Language | SQL++, which is close to SQL | Spark SQL as Databricks runs it, with ANSI mode on. One statement for each request, or a script in BEGIN ... END (Statements) |
| DDL | In SQL++ | In SQL. A key is declared and not enforced (Statements) |
| Parameters | ?, $1 and $name |
? and :name, each with a type and a text value in parameters. The server refuses BINARY, ARRAY, MAP and STRUCT (Parameters) |
| Framing | One body for the whole result, which does not page | One JSON object, with the status, then the manifest, then the rows of the first chunk in result.data_array. A result of more than one chunk, and a result of external links, are not read (Responses) |
| Columns | signature, before the first row |
manifest.schema.columns, before the first row, with the name, the position and the type of each column (Responses) |
| Order | The projection on 7.6 and 8.0, the names on 7.2 | The statement (Responses) |
| Errors | Can come with HTTP 200, after some rows | A statement that fails is HTTP 200 and the state FAILED, before any row, with error_code, sql_state and a message. A request that the server refuses has HTTP 400, 403 or 404 (Errors) |
| Types | JSON. No date, decimal, UUID or binary | JSON, and every value is a string or null, with the type text of the column. A complex value is JSON text with every leaf as text (Types) |
| Cancel | The server stops a query when the client leaves | A statement runs on when the client leaves, and POST /api/2.0/sql/statements/<id>/cancel stops it. The client knows the id only from the answer (Cancellation and timeouts) |
| Transactions | BEGIN WORK in SQL++, carried by txid |
None across requests. Each request is its own session (Transactions) |
| Authentication | Basic | A personal access token, as a Bearer token. A client id and a secret can come later (Requests) |
| Default port | 8093, or 18093 with TLS | 443, with TLS always (The DSN) |
The differences that a caller sees:
- A statement can end after the first answer, so the driver polls it by its id until it succeeds. A statement that takes a long time costs a request each interval (D193 item 8).
- The session does not last.
SET,USE, a temporary view and a variable do not reach the next statement (D193 item 5). - A result that the server cuts, and a result of more than one chunk, are errors before any row (D193 item 2).
- A timestamp has three digits of fraction (D193 item 3).
- A transaction has no form (D20 and D193 item 5).
couchbase |
databricks |
|
|---|---|---|
| Size, without tests, on 2026-10-10 | About 1300 lines in 8 files | About 2500 lines in 9 files |
Config |
QueryContext, ScanConsistency, Timeout, Durability, TxTimeout |
Host, Port, Token, Warehouse, Catalog, Schema, Timeout and Insecure. The DSN has the keys catalog, schema, timeout and tls (D193) |
| Options for one statement | Six With options for one statement, through WithOptions or an argument, and two for BeginTx, through WithOptions only (D40, D46 and D109). WithParameter sets any key of the body |
WithTimeout, WithReadonly, WithParameter, WithDatabase, WithSchema and WithCatalog, through WithOptions or an argument (D109). WithParameter sets a key of the body and refuses nine. WithReadonly(true) fails with dbimp.ErrNotSupported |
| Arguments | Sent to the server as args and $name |
Typed parameters, from the Go type of each argument: BIGINT, DOUBLE, STRING, BOOLEAN, DATE, TIMESTAMP, TIMESTAMP_NTZ, DECIMAL(p,s), INTERVAL and VOID for nil. A byte slice, a list and a map fail with dbimp.ErrArguments (databricks/params.go) |
| Rows | dbimp.ObjectRows from the root package, after the driver reads the signature |
A reader of its own, which reads the status, the manifest and the member result, then one row for each call (databricks/rows.go) |
| Types of the columns | ColumnTypeDatabaseTypeName and ColumnTypeScanType from the signature, and ColumnTypeNullable |
The same, and ColumnTypePrecisionScale for a DECIMAL column. ColumnTypeNullable returns true and false, because the manifest has no nullability |
| Values | int64, float64, or *apd.Decimal for an integer too large for int64. Bytes are decoded from base64 (D44) |
By the type of the column, as the type table says. A list, a map and a struct are decoded by the type text of the column, with every leaf decoded by its type (D135 and D193) |
Result of Exec |
RowsAffected from metrics.mutationCount |
RowsAffected from num_affected_rows, or dbimp.ErrNotSupported when the answer has none. LastInsertId always gives dbimp.ErrNotSupported (D178 item 14) |
| Transactions | BeginTx sends BEGIN WORK. ReadOnly sends readonly |
BeginTx returns dbimp.ErrNotSupported (D193 item 5) |
| Reset of a session | ResetSession, which it keeps as a guard (D41 and D102), and IsValid |
None. A connection holds nothing on the server |
| Cancel | The request carries the context, and net/http stops it when the context ends (D36 and D42) |
The request carries the context. When the context ends while the driver polls, the driver sends the cancel by the id, with a limit of 5 seconds. When it ends during the first request, the driver has no id, so it asks for no wait when the deadline is near (D193 item 8 and question 7) |
| Errors | *ResponseError, with the HTTP status, the status of the body, and a list of Error{Code, Msg} |
*Error{HTTPStatus, Code, SQLState, Message, StatementID}, which unwraps to *dbimp.StatusError for an HTTP status, and the sentinels ErrCanceled, ErrClosed, ErrTruncated and ErrCut |
| Authentication | Basic | A Bearer token, which the driver sends only to the host of the DSN. The driver follows no redirect (D193 item 9) |
| Other exports | The With options and Option |
The With options and Option, Error, the four sentinels, Config, ParseDSN and NewConnector |
The differences that a caller sees:
- A value keeps its type, a date, a decimal and an interval too, where Couchbase gives JSON shapes (D135 and D193).
- A list, a map and a struct keep the types of their leaves, and a map loses the type of its keys (D193 item 7).
RowsAffectedgives an error for DDL, and the count for a statement that changes rows (D178 item 14).- The driver sends one request to start a statement and one request for each poll, where Couchbase sends one (D193 item 8).
WithParameterreplaces a member of the body, as in Couchbase, and refuses nine of them (question 10).- A DSN needs a token and a warehouse id (D193 item 4).
- The key
timeoutis a duration with a unit, such as5m, and a bare number is refused (question 8). - A
NULLargument has the typeVOID, which the live run accepted (question 6, D193 item 12).