Skip to content

Commit 544cdc8

Browse files
committed
override createTable in redshift
1 parent 636c015 commit 544cdc8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/cubejs-redshift-driver/src/RedshiftDriver.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
QueryTablesResult,
1616
StreamOptions,
1717
StreamTableDataWithTypes,
18+
TableColumn,
1819
UnloadOptions
1920
} from '@cubejs-backend/base-driver';
2021
import crypto from 'crypto';
@@ -240,6 +241,14 @@ 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+
return super.createTable(quotedTableName, columns);
250+
}
251+
243252
/**
244253
* AWS Redshift doesn't have any special connection check.
245254
* And querying even system tables is billed.

0 commit comments

Comments
 (0)