drizzle-team/drizzle-orm · error · Error

Streaming is not supported by the SingleStore Proxy driver

Error message

Streaming is not supported by the SingleStore Proxy driver

What it means

Thrown by PreparedQuery.iterator (singlestore-proxy/session.ts:168). The proxy driver issues whole-result requests over the remote callback and has no streaming protocol, so async iteration over result rows is not possible; calling .iterator() (or for-await on the query) is rejected.

Source

Thrown at drizzle-orm/src/singlestore-proxy/session.ts:168

				return returningResponse;
			}

			return data;
		}

		const { rows } = await client(queryString, params, 'all');

		if (customResultMapper) {
			return customResultMapper(rows);
		}

		return rows.map((row) => mapResultRow<T['execute']>(fields!, row, joinsNotNullableMap));
	}

	override iterator(
		_placeholderValues: Record<string, unknown> = {},
	): AsyncGenerator<T['iterator']> {
		throw new Error('Streaming is not supported by the SingleStore Proxy driver');
	}
}

export interface SingleStoreRemoteQueryResultHKT extends SingleStoreQueryResultHKT {
	type: SingleStoreRawQueryResult;
}

export interface SingleStoreRemotePreparedQueryHKT extends SingleStorePreparedQueryHKT {
	type: PreparedQuery<Assume<this['config'], SingleStorePreparedQueryConfig>>;
}

View on GitHub (pinned to b7862528fd)

Solutions

  1. Replace iteration with execute()/all() and process the full result array, paginating via LIMIT/OFFSET or keyset pagination for large sets.
  2. Switch to a streaming-capable driver if true streaming is required.
  3. Cap result size with .limit() and loop in application code over paginated batches.

Example fix

// before (proxy driver)
for await (const row of db.select().from(bigTable)) { handle(row); }
// after
const pageSize = 1000;
let offset = 0;
while (true) {
  const rows = await db.select().from(bigTable).limit(pageSize).offset(offset);
  if (!rows.length) break;
  for (const row of rows) handle(row);
  offset += pageSize;
}
Defensive patterns

Strategy: type-guard

Validate before calling

function driverSupportsStreaming(db) {
  return !/SingleStoreRemoteSession|SingleStoreProxy/.test(db?.session?.constructor?.name ?? '');
}
if (!driverSupportsStreaming(db)) {
  // use pagination instead of iterator()
}

Type guard

function isProxyDriver(db) {
  return /SingleStoreRemoteSession|SingleStoreProxy/.test(db?.session?.constructor?.name ?? '');
}

Prevention

When it happens

Trigger: Calling db.select(...).iterator() or `for await (const row of db.select(...))` on a database built with drizzle-orm/singlestore-proxy; using streaming to handle large result sets in an edge/proxy deployment.

Common situations: Porting streaming code from the node mysql2 driver to the proxy driver; memory-conscious large exports that rely on iterator() in a serverless function.

Related errors


AI-assisted analysis of drizzle-team/drizzle-orm@b7862528fd (2026-08-03). Data as JSON: /data/errors/c5f9fe15194aac5c.json. Report an issue: GitHub.