@cubejs-backend/postgres-driver
Advanced tools
Comparing version 0.10.30 to 0.10.32
@@ -6,2 +6,13 @@ # Change Log | ||
## [0.10.32](https://github.com/statsbotco/cubejs-client/compare/v0.10.31...v0.10.32) (2019-09-06) | ||
### Features | ||
* Speedup PG external pre-aggregations ([#201](https://github.com/statsbotco/cubejs-client/issues/201)) ([7abf504](https://github.com/statsbotco/cubejs-client/commit/7abf504)), closes [#200](https://github.com/statsbotco/cubejs-client/issues/200) | ||
## [0.10.30](https://github.com/statsbotco/cubejs-client/compare/v0.10.29...v0.10.30) (2019-08-26) | ||
@@ -8,0 +19,0 @@ |
@@ -54,2 +54,20 @@ const BaseDriver = require('@cubejs-backend/query-orchestrator/driver/BaseDriver'); | ||
async uploadTable(table, columns, tableData) { | ||
if (!tableData.rows) { | ||
throw new Error(`${this.constructor} driver supports only rows upload`); | ||
} | ||
await this.createTable(table, columns); | ||
try { | ||
await this.query( | ||
`INSERT INTO ${table} | ||
(${columns.map(c => this.quoteIdentifier(c.name)).join(', ')}) | ||
SELECT * FROM UNNEST (${columns.map((c, columnIndex) => `${this.param(columnIndex)}::${this.fromGenericType(c.type)}[]`).join(', ')})`, | ||
columns.map(c => tableData.rows.map(r => r[c.name])) | ||
); | ||
} catch (e) { | ||
await this.dropTable(table); | ||
throw e; | ||
} | ||
} | ||
release() { | ||
@@ -56,0 +74,0 @@ return this.pool.end(); |
@@ -5,3 +5,3 @@ { | ||
"author": "Statsbot, Inc.", | ||
"version": "0.10.30", | ||
"version": "0.10.32", | ||
"engines": { | ||
@@ -11,8 +11,17 @@ "node": ">=8.11.1" | ||
"main": "driver/PostgresDriver.js", | ||
"scripts": { | ||
"lint": "eslint **/*.js" | ||
}, | ||
"dependencies": { | ||
"@cubejs-backend/query-orchestrator": "^0.10.30", | ||
"@cubejs-backend/query-orchestrator": "^0.10.32", | ||
"pg": "^7.8.0" | ||
}, | ||
"license": "Apache-2.0", | ||
"gitHead": "4c835abe39cac254ea6e3ac82cc26523a9e85240" | ||
"devDependencies": { | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-node": "^5.2.1" | ||
}, | ||
"gitHead": "7f5981ac0b3325e0c632f6fba185e49e0a2fc36a" | ||
} |
21355
76
4