I want to ask if anyone has the same problem or was able to use an workaround for this.
The SQL script component allows to execute multiple scripts by separating them using ";"
This is useful if you want to execute something sequentially and it is one unit of work so you want to keep it inside one component.
I expected that I can use multiple statements inside this component for session based features.
So e.g. temporary Snowflake tables (https://docs.snowflake.com/en/user-guide/tables-temp-transient.html)
This kind of table only exists during the session runtime. I needed an actual table instead of an result set due to another issue.
What happened was that sometimes my script could not find this temporary table.
The issue seems to be that Matillions connection pooling can use different connections/sessions for the statements inside the SQL.
I was able to solve this by creating an transient table at the start and dropping this table at the end of the script.
But now I am facing another issue.
We have workloads that require other warehouse sizes.
The current solution is scaling up our default warehouse and scaling it down afterwards. This has some flaws. With multiple jobs scaling the warehouse, it might happen that one job is scaling the warehouse down but the other jobs still needs the larger one.
It also has the issue that during the time we need this scaled warehouse some smaller jobs will use this warehouse and will generate more costs due to the horizontal scaling.
So what we want to do is to use warehouses with different sizes instead of scaling one warehouse up and down. e.b. MATILLION_SMALL, MATILLION_LARGE
A lot of our business logic is inside sql script components (if this is good or not is another discussion).
The first problem is that this component has no parameter to select the warehouse it should use. My colleague already created an idea for this (https://metlcommunity.matillion.com/s/idea/0874G000000kBoVQAU/detail)
I thought well I can use the statement "USE WAREHOUSE XY;" before executing my script.
But with this session/connection pooling issue in mind this will result in random selection of warehouses when multiple jobs are running at the same time.
So you have to use the default warehouse when using the SQL Script Component? Any ideas how to fix this?
I created an Idea for this issue:
(https://metlcommunity.matillion.com/s/idea/0874G000000kBpYQAU/detail)
My personal opinion is that the SQL Script component should not use this session pooling and the expected behavior is that everything is running in the same session.
But maybe this is only my personal opinion and this has and good reason?