Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Truncating table after copying the data to another table

  1. #1
    Join Date
    Apr 2007
    Posts
    19

    Default Truncating table after copying the data to another table

    Hi all,,

    I have a requirement where I have to copy the contents of one table to another and delete the data from source table?

    How could I achieve this in one transformation? I have looked at TableOutput and Delete transformation steps but not sure how I do the copy and the delete in the same transformation.

    Any help is greatly appreciated.

    Thanks in advance
    Uppili

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

    Default

    I would try your load of the table followed by a blocking step, followed by a delete step.

    YMMV as since it's one transformation the original transaction may not have closed yet.

    Regards,
    Sven
    Last edited by sboden; 08-02-2007 at 01:45 PM.

  3. #3
    Join Date
    Apr 2007
    Posts
    19

    Default

    Thanks, Sven for the quick response. I was not aware of Blocking step, it is great to be aware of it now.

    In the delete step, it does seem like the lookup keys are mandatory. How can I get around that?

    Thanks again
    Uppili

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

    Default

    just checked... delete step deletes, it does not truncate. The table output step truncates but only at initialization time.

    So no luck today I think: maybe run a job with your real transformation, followed by a transformation with possibly either a table output step to truncate or in the worst case launch a script to do the truncate outside of PDI.

    Regards,
    Sven

  5. #5
    Join Date
    Apr 2007
    Posts
    19

    Default

    Sven,

    I tried using a Blocking Step followed by an ExecSQLScript step to delete the records but for some reason it did not work.

    So I took the other route of creating two transformations, one for copying and one for deleting.

    Thanks for your suggestions.

    Regards
    Uppili

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.