Skip to content

Configure database variables in dataflow#2685

Open
csafreen wants to merge 10 commits into
developfrom
csafreen/dataflow_database_var
Open

Configure database variables in dataflow#2685
csafreen wants to merge 10 commits into
developfrom
csafreen/dataflow_database_var

Conversation

@csafreen

Copy link
Copy Markdown
Collaborator

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.

  • Automated Tests (Jasmine integration tests, Unit tests, and/or Performance tests)
  • Updated Manual tests / Demo Config
  • Documentation (Application guide, Admin guide, Markdown, Readme and/or Wiki)
  • Verified that local development environment is working with latest changes (integrated with latest develop branch)
  • following best practices in code review doc

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class “database variables” to the Flow UI so users can define reusable database configurations (name → database code + schema) in the Variables panel, then reference them from DB reader/writer nodes. It also wires the new databases payload through save/export/import/run and into the job plugin / Prefect parameter transformation so DB nodes can resolve variable names to concrete database codes at execution time.

Changes:

  • Extend flow state/DTOs to persist databases: DatabaseVariable[] alongside existing variables/import libs.
  • Add a new Databases section in the Variables drawer (with a dedicated DatabaseVariableForm) and update DB reader/writer drawers to select from configured database variables.
  • Update job plugin parameter transformation to pass databases through and resolve DB variable names to concrete DB codes/schemas for db_reader/db_writer nodes.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
plugins/ui/apps/flow/src/features/flow/types/state.ts Adds databases to the root flow state shape.
plugins/ui/apps/flow/src/features/flow/types/dataflow.state.ts Adds databases to exported/saved flow DTOs.
plugins/ui/apps/flow/src/features/flow/types/common.ts Introduces DatabaseVariable type.
plugins/ui/apps/flow/src/features/flow/reducers.ts Adds databases to initial state and a replaceDatabases action.
plugins/ui/apps/flow/src/features/flow/containers/Node/NodeTypes/DbWriterNode/DbWriterDrawer.tsx Switches DB selection to configured database variables and auto-fills schema on selection.
plugins/ui/apps/flow/src/features/flow/containers/Node/NodeTypes/DbReaderNode/DbReaderDrawer.tsx Switches DB selection to configured database variables.
plugins/ui/apps/flow/src/features/flow/containers/FlowLayout.tsx Loads databases into Redux from fetched dataflow revisions.
plugins/ui/apps/flow/src/features/flow/containers/Flow/SaveFlow/SaveFlowDialog.tsx Persists databases when saving flows (including template creation path).
plugins/ui/apps/flow/src/features/flow/containers/Flow/RunFlow/RunFlowButton.tsx Includes databases in test-run request payload.
plugins/ui/apps/flow/src/features/flow/containers/Flow/ImportFlow/ImportFlowButton.tsx Imports databases from JSON and stores in Redux.
plugins/ui/apps/flow/src/features/flow/containers/Flow/FlowVariables/FlowVariablesDrawer.tsx Adds Databases editor UI and applies replaceDatabases on Apply.
plugins/ui/apps/flow/src/features/flow/containers/Flow/FlowVariables/FlowVariablesButton.tsx Updates badge count to include databases + variables.
plugins/ui/apps/flow/src/features/flow/containers/Flow/FlowVariables/DatabaseVariableForm/DatabaseVariableForm.tsx New form component for editing database variables.
plugins/ui/apps/flow/src/features/flow/containers/Flow/FlowVariables/DatabaseVariableForm/DatabaseVariableForm.scss Styles for the new database variable form row.
plugins/ui/apps/flow/src/features/flow/containers/Flow/ExportFlow/ExportFlowButton.tsx Exports databases into the JSON export.
plugins/functions/jobplugins/src/utils/DataflowParser.ts Passes databases through and resolves db node database from variable name → db code (+ schema defaulting for writer).
plugins/functions/jobplugins/src/types.ts Adds DatabaseVariable and includes databases in flow/Prefect parameter types.
plugins/flows/data_transformation/dataflow_ui_plugin/nodes.py Injects database variables into Python node execution context via SimpleNamespace.
plugins/flows/data_transformation/dataflow_ui_plugin/flow.py Accepts databases in flow signature and passes them into node execution (notably Python nodes).

Comment on lines +193 to +196
case NodeType.CSV | NodeType.DBREADER | NodeType.CONCEPTMAPPING | NodeType.FILE | NodeType.WHITERABBIT:
result = _node.task(task_run_context)
case NodeType.PYTHON:
result = _node.task(input, shared_variables, importlibs, task_run_context)
result = _node.task(input, shared_variables, importlibs, task_run_context, databases or [])
Comment on lines +248 to 252
def test(self, _input: dict[str, Result],
shared_variables: dict[str, str],
importlibs: list[str],
task_run_context):
return self.task(_input, shared_variables, importlibs, task_run_context)
Comment on lines 146 to +149
onChange={(e: SelectChangeEvent<string>) =>
onFormDataChange({ database: e.target.value })
}
disabled={isLoadingDatabases}
disabled={databases.length === 0}
@@ -154,16 +163,27 @@ export const DbWriterDrawer: FC<DbWriterDrawerProps> = ({
<Select
value={formData.database}
Comment on lines +130 to +136
const handleApply = useCallback(() => {
dispatch(replaceVariables(localVariables));
dispatch(replaceImportLibs(localImportLibs));
dispatch(replaceDatabases(localDatabases));
dispatch(markStatusAsDraft());
handleClose();
}, [localVariables, localImportLibs, handleClose]);
}, [localVariables, localImportLibs, localDatabases, handleClose]);
Comment on lines 236 to 242
export interface IReactFlow {
nodes: IReactFlowNode[];
edges: IReactFlowEdge[];
variables: KeyValue[];
importLibs: string[];
databases: DatabaseVariable[];
}
Comment thread plugins/fhir_functions/fhir-init/index.ts
Comment thread plugins/flows/_shared_flow_utils/dao/trexdao.py

const dbList = await dbCredentialsAPI.getDbList();
const exist = dbList.find((db) => db.code === env.FHIR_DATABASE_CODE);
if (exist && exist.dialect === "trex") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a dialect that is trex?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FHIR db entry is created with dialect trex cause of the way its being connected in DBReader nodes.

@csafreen csafreen requested a review from brandantck June 19, 2026 05:53
@csafreen csafreen enabled auto-merge June 19, 2026 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants