Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Snowflake PUT task to load data from internal storage #138

Open
Tracked by #161
anna-geller opened this issue Jun 30, 2023 · 5 comments
Open
Tracked by #161

Add a Snowflake PUT task to load data from internal storage #138

anna-geller opened this issue Jun 30, 2023 · 5 comments
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working good first issue Great issue for new contributors

Comments

@anna-geller
Copy link
Member

anna-geller commented Jun 30, 2023

Issue description

Reproducible example:

id: snowflakeTutorial
namespace: dev

tasks:
  - id: createDB
    type: io.kestra.plugin.jdbc.snowflake.Query
    sql: CREATE OR REPLACE DATABASE KESTRA;

  - id: createTable
    type: io.kestra.plugin.jdbc.snowflake.Query
    sql: |
      CREATE OR REPLACE TABLE KESTRA.PUBLIC.EMPLOYEES (
        first_name STRING ,
        last_name STRING ,
        email STRING ,
        streetaddress STRING ,
        city STRING ,
        start_date DATE
        );

  - id: extract
    type: io.kestra.plugin.fs.http.Download
    uri: https://raw.githubusercontent.com/kestra-io/examples/main/datasets/employees01.csv

  - id: load
    type: io.kestra.plugin.jdbc.snowflake.Query
    sql: put file://{{outputs.extract.uri}} @kestra.public.%employees

taskDefaults:
  - type: io.kestra.plugin.jdbc.snowflake.Query
    values:
      url: jdbc:snowflake://accountid.snowflakecomputing.com?warehouse=DEMO
      username: ANNA
      password: 'password'
@github-project-automation github-project-automation bot moved this to Backlog in All issues Jun 30, 2023
@Ben8t Ben8t moved this from Backlog to Ready in All issues Jul 4, 2023
@Ben8t Ben8t added the bug Something isn't working label Jul 7, 2023
@anna-geller anna-geller changed the title Snowflake query task cannot use tasks from internal storage: File not found. Snowflake query task cannot use files from internal storage: File not found. Jul 16, 2023
@loicmathieu loicmathieu moved this from Ready to In Progress in All issues Jul 17, 2023
@loicmathieu loicmathieu self-assigned this Jul 17, 2023
@loicmathieu
Copy link
Member

@anna-geller the Query task uses plain SQL so what you try to achieve cannot be don.
Keep in mind that task must handle specifically outputs from internal storage, {{outputs.extract.uri}} will resolve to something like kestra:///namespace/flow/exec/....
For this to work you must use a local file so the WorkingDirectory and the LocalFiles task may allow to do such thing.

Or we may provide a Put task.

@loicmathieu
Copy link
Member

By the way, there is an Upload task, does it provide this functionality?

@anna-geller
Copy link
Member Author

it does, I added blueprint for it https://demo.kestra.io/ui/blueprints/community/81

but Ludo agreed that we should support plain PUT command as well because it's more flexible

@loicmathieu
Copy link
Member

We should create a dedicated task for that, the Query task doesn't seem to fit the PUT command

@anna-geller
Copy link
Member Author

anna-geller commented Jul 17, 2023

sure why not

The default Snowflake tutorial runs PUT queries from the SnowSQL CLI so query would work but if you have a specific design in mind for the PUT task, can you share how would it look like? https://docs.snowflake.com/en/user-guide/getting-started-tutorial-stage-data-files

the common use is to run PUT and then COPY INTO which are just SQL statements albeit specific ones I agree

@loicmathieu loicmathieu removed their assignment Aug 2, 2023
@loicmathieu loicmathieu moved this from In Progress to Ready in All issues Aug 2, 2023
@anna-geller anna-geller removed this from All issues Oct 30, 2023
@anna-geller anna-geller added this to the v0.19.0 milestone Dec 5, 2023
@github-project-automation github-project-automation bot moved this to Backlog in Issues Jun 10, 2024
@anna-geller anna-geller removed this from the v0.19.0 milestone Aug 15, 2024
@anna-geller anna-geller added the area/plugin Plugin-related issue or feature request label Aug 15, 2024
@anna-geller anna-geller changed the title Snowflake query task cannot use files from internal storage: File not found. Add a Snowflake PUT task to load data from internal storage Oct 10, 2024
@anna-geller anna-geller added the good first issue Great issue for new contributors label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working good first issue Great issue for new contributors
Projects
Status: Backlog
Status: Planned
Development

No branches or pull requests

3 participants