Hi @veerahkr
Welcome to the community and thanks for being patient.
Can you share further details about the setup? Unfortunately, I am not able to see how your app/integration interacts with Pipedrive and how the issue originates as a result of that.
Hey veerahkr, Snowflake doesn’t have a native way to raise warnings on arbitrary SQL patterns outside of scripting blocks, so you’re right that exception handling alone won’t cover this.
The most practical route is parsing the query text before it runs. Python’s sqlparse library can tokenize an ON clause and you check whether both sides of the = share the same table qualifier. Something like extracting the identifiers from each comparison, splitting on the dot, and comparing the table prefix. You can wire that into whatever layer accepts queries from users and reject or flag them before they ever hit Snowflake.
SELECT operator_id,
operator_statistics:output_rows / operator_statistics:input_rows AS row_multiple
FROM TABLE(GET_QUERY_OPERATOR_STATS(LAST_QUERY_ID()))
WHERE operator_type = 'Join';
A ratio way above 1.0 on what should be a normal join is a strong signal of a self reference or missing predicate. We see this across a lot of client Snowflake environments at Stacksync and the pre execution parse approach saves a lot more pain than profiling after the fan out already happened.