[Data - 2745] Fix update metadata#2866
Open
Zhimin-arya wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix dataset “update metadata” / cache-related behavior by ensuring cache DB files can be attached/created when missing and by propagating a cache_id through dataset creation and cache creation flows.
Changes:
- Trex startup and DBM attach route now call
ensureAttached(..., { createDbFileIfMissing: true })when attaching cache DBs. - Dataset function now includes a derived
cache_idin thecreate_datamodelflow options payload. - Cache DB file creation flow now uses
cache_id(when provided) to choose the DuckDB target database name and DuckDB file path; OMOP CDM flow passescacheIdthrough to the cache creation flow.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/trex/core/server/routes/dbm.ts | Enables creating/attaching cache DB files on-demand during the DBM attach request. |
| services/trex/core/server/index.ts | Enables creating/attaching cache DB files during Trex startup attach phase. |
| plugins/functions/dataset/index.ts | Adds cache_id derivation and sends it to the datamodel creation flow. |
| plugins/flows/base/omop_cdm_plugin/flow.py | Passes cacheId into CreateCacheOptions so cache creation uses the intended cache identifier. |
| plugins/flows/base/create_cachedb_file_plugin/flow.py | Uses cache_id (if set) to determine DuckDB file path and target database alias. |
Comment on lines
+42
to
+48
| private deriveCacheId(datasetId: string, databaseCode: string, dialect: DbDialect) { | ||
| if (dialect === DbDialect.Hana) { | ||
| return databaseCode; | ||
| } | ||
| const cleaned = datasetId.replace(/-/g, "_"); | ||
| return /^[0-9]/.test(cleaned) ? `_${cleaned}` : cleaned; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cause is when add new dataset:
Fix: derive cache_id after new dataset created and pass it when trigger create_cache_file plugin
Fix: set createDbFileIfMissing: true
Before:
After:
Merge Checklist
Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.
developbranch)