cgrant
Databricks Employee
Databricks Employee

Trying to serialize as binary can be pretty challenging, here's a way to do this with base64 - the trick is to serialize as base64 string and insert as binary with unbase64. 

databricks api post /api/2.0/sql/statements --json '{
  "warehouse_id": "warehouse-id",
  "catalog": "catalog",
  "schema": "schema", 
  "statement": "INSERT INTO binary (bin) VALUES (unbase64(:bin))",
  "parameters": [
    {"name": "bin", "value": "$(cat ~/pixel.png | base64)", "type": "STRING"}
  ]
}'

 

View solution in original post