Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Checking if a field exists

  1. #1
    Join Date
    Oct 2007
    Posts
    19

    Default Checking if a field exists

    I know it is possible to check if a table exists, it is possible to check if a field exists?
    The problem arises because if I try to select a field from a table and it doesn't exist I get an error and the entire job will stop.

    I'm using kettle 2.4.0.

    Thanks.

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    No... and I don't see a lot of uses for it. If you don't know upfront the columns of a table you have more serious problems.

    Regards,
    Sven

  3. #3
    Join Date
    Oct 2007
    Posts
    19

    Default

    Quote Originally Posted by sboden View Post
    No... and I don't see a lot of uses for it. If you don't know upfront the columns of a table you have more serious problems.
    You could say the same about table existence, don't you?

    The project I'm building should work with different versions of the schema, the newer versions have that field, the older ones don't have it. There is a task that shoud be done on newer versions where that field if exists and, indeed, not on the older ones.
    Unfortunately there is no trivial way to check the version of the schema but I'd like to automatically detect what should be done without messing with configuration settings if possible.

    I could be happy if the job would fail when the field doesn't exist without stopping other jobs that should run after it but I don't know how to do it. Is it possible?

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    Quote Originally Posted by alesta View Post
    You could say the same about table existence, don't you?
    maybe true

    Quote Originally Posted by alesta View Post
    I could be happy if the job would fail when the field doesn't exist without stopping other jobs that should run after it but I don't know how to do it. Is it possible?
    Run a transformation using that column in a table input (selecting only first row or so). And depending on success of that transformation either do the real job or skip it.

    Regards,
    Sven

  5. #5
    Join Date
    Oct 2007
    Posts
    19

    Default

    Quote Originally Posted by sboden View Post
    Run a transformation using that column in a table input (selecting only first row or so). And depending on success of that transformation either do the real job or skip it.
    I believe I already tried it, but maybe I did something wrong. I'll try again.

    In the meanwhile I found an example on PDI 2.5 FAQ showing how to check it using JavaScript Value based on row object.

  6. #6
    Join Date
    Oct 2007
    Posts
    19

    Default

    Quote Originally Posted by sboden View Post
    Run a transformation using that column in a table input (selecting only first row or so). And depending on success of that transformation either do the real job or skip it.
    Quote Originally Posted by alesta View Post
    I believe I already tried it, but maybe I did something wrong. I'll try again.

    Hum, I'm still convinced there is no way to continue after a transformation failure. Am I wrong?

  7. #7
    Join Date
    May 2006
    Posts
    4,882

    Default

    Example attached.

    Regards,
    Sven
    Attached Files Attached Files

  8. #8
    Join Date
    Oct 2007
    Posts
    19

    Default

    Quote Originally Posted by sboden View Post
    Example attached.

    Thanks.
    I can't figure why I was thinking that setting the "evaluation" property on hops was useful only after an evaluation step

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.