{"record":{"id":"f055a6189cf587b9","repo":"cube-js/cube","slug":"this-constructor-driver-supports-only-rows-uplo","errorCode":null,"errorMessage":"${this.constructor} driver supports only rows upload","messagePattern":"(.+?) driver supports only rows upload","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-base-driver/src/BaseDriver.ts","lineNumber":489,"sourceCode":"  public param(_paramIndex: number): string {\n    return '?';\n  }\n\n  public testConnectionTimeout() {\n    return this.testConnectionTimeoutValue;\n  }\n\n  public async downloadTable(table: string, _options: ExternalDriverCompatibilities): Promise<TableMemoryData> {\n    return { rows: await this.query(`SELECT * FROM ${table}`) };\n  }\n\n  public async uploadTable(table: string, columns: TableStructure, tableData: DownloadTableData) {\n    return this.uploadTableWithIndexes(table, columns, tableData, [], null, [], {});\n  }\n\n  public async uploadTableWithIndexes(table: string, columns: TableStructure, tableData: DownloadTableData, indexesSql: IndexesSQL, _uniqueKeyColumns: string[] | null, _queryTracingObj: any, _externalOptions: ExternalCreateTableOptions) {\n    if (!isDownloadTableMemoryData(tableData)) {\n      throw new Error(`${this.constructor} driver supports only rows upload`);\n    }\n\n    await this.createTable(table, columns);\n    try {\n      if (isDownloadTableMemoryData(tableData)) {\n        for (let i = 0; i < tableData.rows.length; i++) {\n          await this.query(\n            `INSERT INTO ${table}\n          (${columns.map(c => this.quoteIdentifier(c.name)).join(', ')})\n          VALUES (${columns.map((c, paramIndex) => this.param(paramIndex)).join(', ')})`,\n            columns.map(c => this.toColumnValue(tableData.rows[i][c.name] as string, c.type))\n          );\n        }\n        for (let i = 0; i < indexesSql.length; i++) {\n          const [query, params] = indexesSql[i].sql;\n          await this.query(query, params);\n        }\n      }","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-base-driver/src/BaseDriver.ts#L471-L507","documentation":"uploadTableWithIndexes() only supports table data supplied as in-memory rows (isDownloadTableMemoryData). If tableData is a stream-based or reference-based (e.g. unload-to-S3) form, the driver throws this error.","triggerScenarios":"Calling uploadTable()/uploadTableWithIndexes() with DownloadTableData that contains streams or remote file references instead of a rows array.","commonSituations":"Copying unload results (e.g. from BigQuery unload producing CSV URLs) into a driver that only accepts row arrays, or passing streamed query results between drivers.","solutions":["Materialize the data into rows before uploading (fetch stream fully and pass { rows })","Use a driver/storage-fs path that supports the given data form (e.g. CSV unload/ingest instead of row upload)","Convert remote CSV files to rows via downloadQueryResults or CSV parsing","Check which DownloadTableData variant the target driver supports"],"exampleFix":"// before\ntarget.uploadTable('tbl', cols, unloadedCsvRef); // stream/ref form\n// after\nconst rows = await parseCsvToRows(unloadedCsvRef);\ntarget.uploadTable('tbl', cols, { rows });","handlingStrategy":"type-guard","validationCode":"import { isDownloadTableMemoryData } from '@cubejs-backend/base-driver';\nif (!isDownloadTableMemoryData(tableData)) throw new Error('Driver needs rows: materialize before upload');","typeGuard":"function isRowUploadData(d: DownloadTableData): d is DownloadTableMemoryData {\n  return Array.isArray((d as any).rows);\n}","tryCatchPattern":"try {\n  await target.uploadTable(table, cols, data);\n} catch (e) {\n  if (/supports only rows upload/.test(e.message)) {\n    const rows = await materializeToRows(data);\n    await target.uploadTable(table, cols, { rows });\n  } else throw e;\n}","preventionTips":["Always materialize streams/remote refs to rows before row-based uploads","Check target driver capabilities when designing cross-driver copy flows","Centralize a data-shape adapter between unload results and uploads","Document which DownloadTableData variant each driver accepts"],"tags":["driver","upload","unsupported-operation"],"backgroundTag":"unsupported-data-upload-format","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}