Skip to content

Commit

Permalink
query: add class information for queries created from data-spaces (#2018
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gayathrir11 committed Mar 17, 2023
1 parent cc0030d commit 4f622a8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/little-flies-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@finos/legend-extension-dsl-data-space': patch
---

Modify `Query` to have `classPath` as tagged value when we save it via dataspace workflow
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

// NOTE: these are non-compilable profile and tag that we come up with for query
// so that it records the dataSpace it is created from
// to store extra metadata
export const QUERY_PROFILE_PATH = 'meta::pure::profiles::query';
export const QUERY_PROFILE_TAG_DATA_SPACE = 'dataSpace';
export const QUERY_PROFILE_TAG_CLASS = 'class';
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
} from '@finos/legend-shared';
import {
QUERY_PROFILE_PATH,
QUERY_PROFILE_TAG_CLASS,
QUERY_PROFILE_TAG_DATA_SPACE,
} from '../../DSL_DataSpace_Const.js';
import { getDataSpace } from '../../graphManager/DSL_DataSpace_GraphManagerHelper.js';
Expand All @@ -58,6 +59,16 @@ export const createQueryDataSpaceTaggedValue = (
return taggedValue;
};

export const createQueryClassTaggedValue = (
classPath: string,
): QueryTaggedValue => {
const taggedValue = new QueryTaggedValue();
taggedValue.profile = QUERY_PROFILE_PATH;
taggedValue.tag = QUERY_PROFILE_TAG_CLASS;
taggedValue.value = classPath;
return taggedValue;
};

export class DataSpaceQueryCreatorStore extends QueryEditorStore {
groupId: string;
artifactId: string;
Expand Down Expand Up @@ -237,6 +248,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
query.versionId = this.versionId;
query.taggedValues = [
createQueryDataSpaceTaggedValue(this.dataSpacePath),
createQueryClassTaggedValue(guaranteeNonNullable(this.classPath)),
];
},
};
Expand Down

0 comments on commit 4f622a8

Please sign in to comment.