Skip to content

Instantly share code, notes, and snippets.

View ianmcook's full-sized avatar

Ian Cook ianmcook

View GitHub Profile
@ianmcook
ianmcook / arrow-js-zstd-ipc-reproducer.md
Created August 20, 2026 16:14
Arrow JS IPC compression interoperability

Arrow JS IPC compression interoperability

This example demonstrates two different results for Arrow IPC streams with compressed body buffers:

  1. Arrow JS 21.2.0 can read a compressed IPC stream written by PyArrow.
  2. PyArrow cannot read a compressed IPC stream written by Arrow JS 21.2.0.

The same behavior occurs with both allowed codecs (ZSTD and LZ4 Frame). The example below uses ZSTD.

@ianmcook
ianmcook / request-body.json
Last active April 24, 2026 16:06
Use the Snowflake SQL REST API from a shell script with curl and jq to execute a query and download the result partitions in Arrow format
{
"statement": "SELECT * FROM MYTABLE",
"resultSetMetaData": {
"format": "arrowv1"
},
"timeout": 60,
"database": "MYDATABASE",
"schema": "MYSCHEMA",
"warehouse": "MYWAREHOUSE",
"role": "MYROLE"
@ianmcook
ianmcook / driver_manager_uri.md
Last active November 11, 2025 00:40
Proposed APIs for passing solely a URI to the ADBC driver managers

C++

AdbcError error = {};
AdbcDatabase database = {};
AdbcDatabaseNew(&database, &error);

// AdbcDatabaseSetOption(&database, "driver", "<driver>", &error) // should be able to omit this...

AdbcDatabaseSetOption(&database, "uri", "<driver>:<scheme>://<address>", &error); // ...and include only this
@ianmcook
ianmcook / games_data.md
Created September 25, 2025 00:49
How to create games data in several formats
@ianmcook
ianmcook / adbc_snowflake.R
Created September 18, 2025 16:09
Query Snowflake in R with ADBC (using driver manifests)
library(adbcdrivermanager)
drv <- adbc_driver("snowflake")
db <- adbc_database_init(
drv,
username="USER",
password="PASS",
adbc.snowflake.sql.account="ACCOUNT-IDENT",
adbc.snowflake.sql.warehouse="MY_WAREHOUSE",
@ianmcook
ianmcook / request-body.json
Created August 21, 2025 16:08
Use the Snowflake SQL REST API from a shell script with curl and jq to execute multiple queries and download the result partitions in Arrow format
{
"statement": "SELECT * FROM MYTABLEONE; SELECT * FROM MYTABLETWO",
"parameters": {
"MULTI_STATEMENT_COUNT": "2"
},
"resultSetMetaData": {
"format": "arrowv1"
},
"timeout": 60,
"database": "MYDATABASE",
@ianmcook
ianmcook / requirements.txt
Created May 26, 2025 19:41
requirements.txt for building ADBC docs
adbc_driver_flightsql
adbc_driver_manager
adbc_driver_postgresql
adbc_driver_sqlite
furo
numpydoc
pandas
polars
sphinx
sphinx-copybutton
@ianmcook
ianmcook / curl_arrow_pipe_python.md
Last active May 14, 2025 20:37
Pipe Arrow IPC stream from curl to Python

First start an HTTP server to serve Arrow IPC stream data. You can do this using one of the server examples in HTTP GET Arrow Data: Simple Examples or simply by starting a Python HTTP server in the same directory where you have an Arrow IPC stream file (named file.arrows in this example).

python -m http.server 8008

Download the attached Python script script.py. You might need to do chmod +x script.py to make it executable.

@ianmcook
ianmcook / acero_execplan.cpp
Last active April 23, 2025 08:52
Create and execute an Acero ExecPlan
#include <iostream>
#include <arrow/api.h>
#include <arrow/result.h>
#include <arrow/compute/api.h>
#include <arrow/compute/exec/exec_plan.h>
arrow::Status ExecutePlanAndCollectAsTable(
std::shared_ptr<arrow::compute::ExecPlan> plan,
std::shared_ptr<arrow::Schema> schema,
arrow::AsyncGenerator<std::optional<arrow::compute::ExecBatch>> sink_gen) {
@ianmcook
ianmcook / write_arrow_ipc_formats.py
Created April 2, 2025 16:48
Create sample data and write it to two files in Arrow IPC stream format and file format
import pandas as pd
import pyarrow as pa
file_path = 'fruit.arrow'
stream_path = 'fruit.arrows'
df = pd.DataFrame(data={'fruit': ['apple', 'apple', 'apple', 'orange', 'orange', 'orange'],
'variety': ['gala', 'honeycrisp', 'fuji', 'navel', 'valencia', 'cara cara'],
'weight': [134.2 , 158.6, None, 142.1, 96.7, None]})