|
|
@ -558,15 +558,30 @@ export class TablesService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
!tableCreatePayLoad.table_name || |
|
|
|
!tableCreatePayLoad.title |
|
|
|
(base.prefix && base.prefix === tableCreatePayLoad.table_name) |
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
NcError.badRequest( |
|
|
|
NcError.badRequest( |
|
|
|
'Missing table name `table_name` property in request body', |
|
|
|
'Missing table `title` property in request body', |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!tableCreatePayLoad.table_name) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
!(await Model.checkAliasAvailable(context, { |
|
|
|
|
|
|
|
title: tableCreatePayLoad.title, |
|
|
|
|
|
|
|
base_id: base.id, |
|
|
|
|
|
|
|
source_id: source.id, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
NcError.badRequest('Duplicate table alias'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (source.type === 'databricks') { |
|
|
|
if (source.type === 'databricks') { |
|
|
|
tableCreatePayLoad.table_name = tableCreatePayLoad.table_name |
|
|
|
tableCreatePayLoad.table_name = tableCreatePayLoad.table_name |
|
|
|
.replace(/\s/g, '_') |
|
|
|
.replace(/\s/g, '_') |
|
|
@ -608,15 +623,7 @@ export class TablesService { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
!(await Model.checkAliasAvailable(context, { |
|
|
|
|
|
|
|
title: tableCreatePayLoad.title, |
|
|
|
|
|
|
|
base_id: base.id, |
|
|
|
|
|
|
|
source_id: source.id, |
|
|
|
|
|
|
|
})) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
NcError.badRequest('Duplicate table alias'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sqlMgr = await ProjectMgrv2.getSqlMgr(context, base); |
|
|
|
const sqlMgr = await ProjectMgrv2.getSqlMgr(context, base); |
|
|
|
|
|
|
|
|
|
|
|