US and Worldwide: +1 (866) 660-7555
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Creating and loading data into the target table at the run time

  1. #1
    Join Date
    Jun 2012
    Posts
    23

    Default Creating and loading data into the target table at the run time

    Hi,

    Am new to pentaho DI Spoon and need some help on the following requirement.

    We have a requirement where we know the source table name and the target table name. But the number of columns in the source table will change dynamically (based on certain actions from the UI layer).
    So i cannot create a standard job by doing source to target column mapping.
    Is there any procedure / transformation where we connect to the source system and the target system. Then run a sql statement like below
    select * into target_schema.target_table from source_schema.source_table

    Or can we achive this kind of requirement from one or more existing transformations? If yes can you please help me out asap.

  2. #2
    Join Date
    Nov 1999
    Posts
    9,535

    Default

    The general consensus among the Kettle developers is to refuse to implement this feature.
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

  3. #3
    Join Date
    Jun 2012
    Posts
    23

    Default

    Thanks for the reply.

    I cannot refuse this functionality. Is there any work around to do this. Can you pls help me out

  4. #4
    Join Date
    Nov 1999
    Posts
    9,535

    Default

    Really, it's a bad idea, why would you want to do this?
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

  5. #5
    Join Date
    Jun 2012
    Posts
    23

    Default

    hmm,

    Our database schema changes by adding some custom attributes from the product UI layer. So we cannot avoid the customer in using / creating that. So we need to expose those columns in our Datamart. Is there any way to achieve this?

  6. #6
    Join Date
    Nov 1999
    Posts
    9,535

    Default

    Well, to be honest, the foolishness then started in the product UI layer, right? :-)

    OK, so if you would really really would want to do this, despite the fact that everyone says it's madnes... here's how:

    Load the transformation metadata using the "Auto Doc" step (Meta option) giving you a new field that contains the metadata (Java) object of the transformation. You ask that transformation for the list of SQL statements to be executed (in JavaScript for example). Then you execute all those statements (also in JavaScript) and that's it.

    Have fun!

    Matt
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

  7. #7
    Join Date
    Jun 2012
    Posts
    1,474

    Default

    Let's say it can be a requirement to ressurect a relational table with a dynamic structure to get a working copy.
    One can avoid this situation by introducing a meta-meta-layer to a data model, but you need the skills and the chance to do so.
    There are other ways to achieve this (e.g. replication), but we do Kettle here.

    So here is another way to go:

    (1) Write a DROP TABLE statement to a file
    (2) Append the necessary DDL statement
    (3) Append the INSERT INTO statement for each data row
    (4) Process the SQL-file one statement per row

    To automate the whole process a job is needed.
    Attached Files Attached Files
    pdi-ce-4.3.0-stable
    OpenJDK IcedTea 2.3.7 (7u21)
    ubuntu 12.04 LTS (x86_64)

  8. #8
    Join Date
    Nov 1999
    Posts
    9,535

    Default

    Sooner or later I'll have to create an example. I'm just trying to postpone that time as long as possible since it opens Pandora's box of "DROP COLUMN" stupidity.
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

  9. #9
    Join Date
    Jun 2012
    Posts
    23

    Default

    Quote Originally Posted by marabu View Post
    Let's say it can be a requirement to ressurect a relational table with a dynamic structure to get a working copy.
    One can avoid this situation by introducing a meta-meta-layer to a data model, but you need the skills and the chance to do so.
    There are other ways to achieve this (e.g. replication), but we do Kettle here.

    So here is another way to go:

    (1) Write a DROP TABLE statement to a file
    (2) Append the necessary DDL statement
    (3) Append the INSERT INTO statement for each data row
    (4) Process the SQL-file one statement per row

    To automate the whole process a job is needed.

    Thanks alot for your help. Am trying to implement the same in sql server. Will ping you if i need any more help

  10. #10
    Join Date
    Nov 1999
    Posts
    9,535

    Default

    Here is an example, to be un-zipped in samples/transformations:

    dynamic-table.zip

    (updated to work on 4.3.0)
    Last edited by MattCasters; 07-04-2012 at 10:26 AM.
    Matt Casters, Chief Data Integration
    Pentaho, Open Source Business Intelligence
    http://www.pentaho.org -- mcasters@pentaho.org

    Author of the book Pentaho Kettle Solutions by Wiley. Also available as e-Book and on the Kindle reading applications (iPhone, iPad, Android, Kindle devices, ...)

    Join us on IRC server Freenode.net, channel ##pentaho

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •