File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
packages/cubejs-redshift-driver/src Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515 QueryTablesResult ,
1616 StreamOptions ,
1717 StreamTableDataWithTypes ,
18+ TableColumn ,
1819 UnloadOptions
1920} from '@cubejs-backend/base-driver' ;
2021import crypto from 'crypto' ;
@@ -240,6 +241,21 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
240241 }
241242 }
242243
244+ public override async createTable ( quotedTableName : string , columns : TableColumn [ ] ) : Promise < void > {
245+ if ( quotedTableName . length > 127 ) {
246+ throw new Error ( 'Redshift can not work with table names longer than 127 symbols. ' +
247+ `Consider using the 'sqlAlias' attribute in your cube definition for ${ quotedTableName } .` ) ;
248+ }
249+
250+ // we can not call super.createTable(quotedTableName, columns)
251+ // because Postgres has 63 length check. So pasting the code from the base driver
252+ const createTableSql = this . createTableSql ( quotedTableName , columns ) ;
253+ await this . query ( createTableSql , [ ] ) . catch ( e => {
254+ e . message = `Error during create table: ${ createTableSql } : ${ e . message } ` ;
255+ throw e ;
256+ } ) ;
257+ }
258+
243259 /**
244260 * AWS Redshift doesn't have any special connection check.
245261 * And querying even system tables is billed.
You can’t perform that action at this time.
0 commit comments