# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Presto Query
description: |
  A Kubeflow Pipeline component to submit a query to Presto.
inputs:
  - name: host
    type: String
    description: 'Presto Host.'
  - name: catalog
    type: String
    description: 'The name of the catalog.'
  - name: schema
    type: String
    description: 'The name of the schema.'
  - name: query
    type: String
    description: 'The SQL query statements to be executed in Presto'
  - name: user
    type: String
    description: 'The user of the Presto.'
  - name: pwd
    type: String
    description: 'The password of the Presto.'
  - name: output
    description: 'The path or name of the emitted output.'
outputs:
  - name: output
    description: 'The path or name of the emitted output.'
implementation:
  container:
    image: docker.io/mkavi/kubeflow-pipeline-presto:latest
    command: [
python3,  /pipelines/component/src/program.py,
      --host,  {inputValue:  host},
      --catalog, {inputValue: catalog},
      --schema, {inputValue: schema},
      --query, {inputValue: query},
      --user, {inputValue: user},
      --pwd, {inputValue: pwd},
      --output, {inputValue: output}
    ]
    fileOutputs:
      output: /output.txt
