Skip to content

Commit

Permalink
HCK-7741: Oracle 23ai for Duality Views: add where clause at the root…
Browse files Browse the repository at this point in the history
… table level (#124)

* feat: add whereClause property to the view level config, update FE

* fix: correct FE script
  • Loading branch information
AlikRakhmonov authored Aug 28, 2024
1 parent c2bca93 commit dfc2f61
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,18 @@ class SqlDualityViewDdlCreator extends AbstractDualityViewFeDdlCreator {
* @return {string}
* */
_getFromRootTableStatement(view) {
const ddlTableName = this._getNamePrefixedWithSchemaName(view.tableName, view.schemaName);
const aliasStatement = this._getFromRootTableAliasStatement(view);
const tagsClauseStatement = this._getTableTagsStatement(view);
const tableName = this._getNamePrefixedWithSchemaName(view.tableName, view.schemaName);
const tableAlias = this._getFromRootTableAliasStatement(view);
const tableTagsStatement = this._getTableTagsStatement(view);
const whereClause = view.whereClause?.trim();
const whereClauseStatement = whereClause ? `\nWHERE ${whereClause} WITH CHECK OPTION` : '';

const template = this._ddlTemplates.dualityView.sql.fromTableStatement;
return this._assignTemplates(template, {
tableName: ddlTableName,
tableAlias: aliasStatement,
tableTagsStatement: tagsClauseStatement,
tableName,
tableAlias,
tableTagsStatement,
whereClauseStatement,
});
}

Expand Down
1 change: 1 addition & 0 deletions forward_engineering/ddlProvider/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ module.exports = (baseProvider, options, app) => {
modelInfo: {
dbVersion: _.get(viewData, 'schemaData.dbVersion'),
},
whereClause: detailsTab.whereClause,
};
},

Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/ddlProvider/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = {

columnTagsStatement: 'WITH${checkStatement}${etagStatement}${updateStatement}',

fromTableStatement: 'FROM ${tableName}${tableAlias}${tableTagsStatement}',
fromTableStatement: 'FROM ${tableName}${tableAlias}${tableTagsStatement}${whereClauseStatement}',
},
},

Expand Down
9 changes: 9 additions & 0 deletions properties_pane/view_level/viewLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,15 @@
]
}
},
{
"propertyName": "Where clause",
"propertyKeyword": "whereClause",
"propertyType": "text",
"dependency": {
"key": "duality",
"value": true
}
},
{
"propertyName": "Workload analysis",
"propertyKeyword": "analysis",
Expand Down

0 comments on commit dfc2f61

Please sign in to comment.