BigQuery Data Warehouse SDK
@ultracart/bigquery-sdk is a Node.js companion to the
JavaScript REST API SDK. It runs SQL
against your UltraCart data warehouse in BigQuery and streams each row back as a native SDK
model instance: Order, Customer, AutoOrder, and the rest of the same classes the REST API
returns.
Source and issues: UltraCart/rest_api_v2_sdk_javascript_bigquery.
This package is an early release (0.2.0). The authentication, transform, and hydration paths are working and unit tested, and the API surface may still change before 1.0.
When to use it instead of the REST API
Use it for bulk reads over history: seeding a loyalty portal, a nightly customer export, a reporting pipeline, or any job that would otherwise page through tens of thousands of REST responses. The warehouse answers those in one query, and the REST API rate limits do not apply.
Keep using the REST API for everything else. The warehouse is read-only and lags live data by one to two minutes, so it is the wrong source for writes, for checkout-time lookups, and for anything that must reflect the current state of a single record right now.
| Job | Source |
|---|---|
| Full order history for a new system | BigQuery SDK |
| Nightly sync of what changed | BigQuery SDK |
| Aggregate reporting across linked accounts | BigQuery SDK |
| Creating or updating any object | REST API |
| Reading one order during checkout | REST API |
Why the objects line up
The warehouse tables are generated from the same domain model that powers the REST API, so column names and nesting already match the SDK model properties one to one. Only three differences exist, and the package normalizes all three before hydration:
- Dates. BigQuery
DATETIMEcolumns hold UTC wall-clock values with no zone. The package emits ISO 8601 strings with an explicitZ, which is what the SDK models expect. - Primitive arrays. A
string[]ornumber[]is stored as aREPEATED RECORDwith a singlevaluesub-field. The package flattens those back to a primitive array. Object arrays are left as arrays of objects. - Numbers.
INTEGERandNUMERICvalues can arrive as wrapper objects or strings, and are normalized to JavaScriptNumber.
The transform is driven by the BigQuery result schema rather than by runtime type checks, so the same code path handles every table.
What it does not do
The package exposes raw SQL only. You write the SELECT, pass a model class, and iterate the
results. There are no getOrders()-style helpers, no query builder, and no write path.
Because the SDK models and the warehouse schema are generated separately, a schema drift guard ships with the repository and fails when an SDK field no longer has a matching warehouse column. That check runs against a live dataset, so it belongs in the package's own CI rather than in your application.
How access works
Authentication uses Google Application Default Credentials, so no keys appear in code. The Google account or service account you authenticate as must be registered as an UltraCart user with data warehouse permissions, which is what provisions read access to your warehouse project and sets the taxonomy level you can reach. The account owner grants that access, and the merchant documentation covers the grant, the pricing, and the four data access levels: Data Warehouse (BigQuery).
Customer names, emails, and addresses live only in the taxonomy-gated _medium and _high
datasets. Elsewhere those fields are present only as *_hash columns, which have no matching
SDK model property and therefore drop during hydration.
Related tooling
The uc-bq Claude Code CLI
also reads the same warehouse, but it solves a different problem. It builds and replays
reports, charts, and scheduled deliveries for a merchant analyst. This package is a library for
pulling records into your own application.
Next
- Quickstart to install, authenticate, and run a first query.
- Extracting order history for backfill and incremental sync patterns.
- API reference for the full option and return surface.