id: subflow_static_entity namespace: ceo.genius.etl inputs: - id: entity_name type: STRING - id: db_table type: STRING - id: columns type: JSON tasks: # - id: render_synapse_config # type: io.kestra.core.tasks.storages.template # templateUri: "kestra://{{ flow.namespace }}/_templates/{{ inputs.entity_name }}.yml" - id: render_synapse_config type: io.kestra.plugin.core.templating.TemplatedTask spec: | {{ read('nsfile://' ~ flow.namespace ~ '/configs/' ~ inputs.entity_name ~ '.yml') }} - id: run_synapse type: io.kestra.plugin.docker.Run containerImage: thedevilisdero/synapse:latest pullPolicy: ALWAYS inputFiles: synapse.yaml: "{{ read('nsfile://' ~ flow.namespace ~ '/configs/' ~ inputs.entity_name ~ '.yml') }}" commands: - --config - synapse.yaml - run - "{{ inputs.entity_name }}" outputFiles: - "{{ inputs.entity_name }}.csv" - id: delete_from_table type: io.kestra.plugin.jdbc.postgresql.Query url: jdbc:postgresql://avicenna_db:5432/avicenna # ANPASSEN username: johndoe # ANPASSEN password: randompassword # ANPASSEN sql: 'DELETE FROM "{{ inputs.db_table }}";' - id: copy_to_table type: io.kestra.plugin.jdbc.postgresql.CopyIn url: jdbc:postgresql://avicenna_db:5432/avicenna # ANPASSEN username: johndoe # ANPASSEN password: randompassword # ANPASSEN from: "{{ outputs.run_synapse.outputFiles[inputs.entity_name ~ '.csv'] }}" table: '"{{ inputs.db_table }}"' header: true columns: "{{ inputs.columns }}"