Giter Site home page Giter Site logo

Comments (7)

liunaijie avatar liunaijie commented on June 22, 2024

you can use sql transform and inner query feature.
the query like select id, data.MANTER as new_col ...

from seatunnel.

oldwolf1984 avatar oldwolf1984 commented on June 22, 2024

我的源库和目标库都是MongoDB,也可以使用sql么?

from seatunnel.

oldwolf1984 avatar oldwolf1984 commented on June 22, 2024

使用sql 确实可以解决了,但是又有了一个新的问题
QQ截图20240523141109
QQ截图20240523141254

from seatunnel.

liunaijie avatar liunaijie commented on June 22, 2024

使用sql 确实可以解决了,但是又有了一个新的问题 QQ截图20240523141109 QQ截图20240523141254

when you use sql tranfrom.
the field_mapper will ignore. the transform result will same with you query result.

You can change to console sink to verify the result struct.

And you can use multiple tranfroms to generate the result you wanted,
like

transform {
  sql {
       query = ""
       result_table_name = "sql_res1"
   }

   sql {
      query = ""
       source_table_name = "sql_res1"
   }

}


from seatunnel.

oldwolf1984 avatar oldwolf1984 commented on June 22, 2024

你好 我按照上面发的写了两个sql标签,执行的时候后台有报错了
024-05-23 15:35:06,093 ERROR [o.a.s.c.s.SeaTunnel ] [main] - Exception StackTrace:org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:202)
at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:34)
Caused by: org.apache.seatunnel.engine.common.exception.JobDefineCheckException: The source/transform(MongoDB) is not configured with 'result_table_name' option
at org.apache.seatunnel.engine.core.parse.ConfigParserUtil.checkExistTableId(ConfigParserUtil.java:237)
at org.apache.seatunnel.engine.core.parse.ConfigParserUtil.checkComplexGraph(ConfigParserUtil.java:155)
at org.apache.seatunnel.engine.core.parse.ConfigParserUtil.checkGraph(ConfigParserUtil.java:75)
at org.apache.seatunnel.engine.core.parse.MultipleTableJobConfigParser.parse(MultipleTableJobConfigParser.java:179)
at org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.getLogicalDag(ClientJobExecutionEnvironment.java:88)
at org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment.execute(ClientJobExecutionEnvironment.java:156)
at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:149)
... 2 more
Caused by: org.apache.seatunnel.api.configuration.util.OptionValidationException: ErrorCode:[API-02], ErrorDescription:[Option item validate failed] - The option("result_table_name") is incorrectly configured, please refer to the doc: When result_table_name is not specified, the data processed by this plugin will not be registered as a data set (dataStream/dataset) that can be directly accessed by other plugins, or called a temporary table (table)When result_table_name is specified, the data processed by this plugin will be registered as a data set (dataStream/dataset) that can be directly accessed by other plugins, or called a temporary table (table) . The data set (dataStream/dataset) registered here can be directly accessed by other plugins by specifying source_table_name .
... 9 more

QQ截图20240523153840
QQ截图20240523151259

from seatunnel.

oldwolf1984 avatar oldwolf1984 commented on June 22, 2024

QQ截图20240523153947

from seatunnel.

liunaijie avatar liunaijie commented on June 22, 2024
  1. the gived config is not complete
    it should be ( still ignore som config) :
source  {
   xxx {
       result_table_name = "source_result"
       ....
   }
}

transform {
  sql {
       query = ""
       source_table_name = "source_result"
       result_table_name = "sql_res1"    
   }

   sql {
      query = ""
       source_table_name = "sql_res1"
       result_table_name = "sql_res2"  // your exception is this config missing parameters
   }

}

sink {

   xxx {
      source_table_name = "sql_res2"
      ......
   }

}

  1. in your second query, you want query from sink table, this is not right. you can only query from the source table.

data flow is source -> transform -> sink

and also not support query with multiple table using like join

  1. for your case, your can try (i am not sure it can work, just suggestion)
    a. select data.A as data.B from source
    b. using json tranform

from seatunnel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.