Customer Portal

Connection Keep-Alive for SQL Temp Table

Comments 2

  • Avatar
    Vladimir Barton
    0
    Comment actions Permalink
    Hi Jesse,
    in CloverETL, there is indeed a way how to achieve what you described in your update. By default, each thread gets its own connection instance, thus avoiding issues when multiple components read/write from/to a DB using the same connection definition. However, this behavior can be changed by setting the Thread-Safe Connection check box to FALSE in the connection definition (Advanced tab). As a result, multiple components will share a single connection instance in the graph run. Let me demonstrate with the following example:

    Based on your update, let me break the scenario down into these stages of the graph run:
    • Creation of the temp table (by using DBExecute)

    • Loading data from S3 into the temp table (by using DBOutputTable, among other components of course)

    • Inserting the content of the temp table into a persistent table (by using DBExecute)

    If the Thread-Safe Connection checkbox was set to TRUE, CloverETL would create a new connection instance for the step #1 and would close it when the step #1 finishes. As a result, the SQL temp table would get deleted after step #1 and the graph would error out as there would not be any table to write to in the step #2.
    If the Thread-Safe Connection checkbox was set to FALSE, CloverETL would open up a single connection instance that would not get closed until the step #3 finishes.
    Note: setting the Thread-Safe Connection checkbox to FALSE is generally not recommended due to potential data conflicts and deadlocks. However, it might be beneficial in your particular case. Suggested is to assign each component (that is using the connection definition) with a different phase in order to prevent concurrent actions from being performed.
    Regards,
  • Avatar
    jesse.miller
    0
    Comment actions Permalink
    Perfect! Thanks Vladimir, works as expected.

Please sign in to leave a comment.