-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql-runner fails on IF EXISTS statements #38
Comments
/cc @bogaert |
Using psql:
It has to be a bug in the underlying Golang Postgres driver. We could try to upgrade to v3 of that driver and see if the problem goes away; if not then I think we have to raise a bug with the driver maintainers. |
Hey @alexanderdean not sure where to go with this ticket as we have this command in our integration-test with no issues. |
I have seen this issue when running Snowplow playbooks - this may be a Postgres vs Redshift issue? |
Quite possible! I will try running this against a Redshift target to re-create. |
Thanks Josh! |
This fails against a Redshift Target with v2 and v3. |
Further on this it is not just the |
Can you reproduce with |
Can confirm that this is only an issue with SQL Runner, running the same playbook from CLI using psql works exactly as it should. Should we raise an issue with them about this? |
That's super weird. It must be a bug in the Golang PG v2 driver. Can we try upgrading to the v3, see if the problem goes away? |
Did that already sadly. |
Let's create a separate ticket to upgrade to v3 of the PG driver in this release anyway... |
SQL Runner fails when running both of the following commands: DROP SCHEMA IF EXISTS any_schema_here CASCADE;
-- OR
CREATE SCHEMA any_schema_here; I tried running both of these lines against a fresh Redshift cluster and they both failed with the: From psql to the same cluster everything runs as expected. |
We also faced the same issue here, but IIRC doing the schema manipulation queries as the only query in a separate step worked, at least on Redshift, but I might be misremembering. |
I've just run into this bug too on 0.4.0.
When running DROP SCHEMA IF EXISTS followed by CREATE SCHEMA then commands which depend on the schema. I can confirm that moving the schema DROP/CREATE into its own step is an effective workaround. The scripts work ok when run through Navicat, so it's a sql-runner specific thing. |
In case anybody keeps hitting this problem like happend with us: the only way that seemed to solve this was to move
from the top of 00-preparation to the end of 08-track-queries. |
Thanks for sharing Simon! |
Pushing back |
For example, web-incremental step 00-preparation:
https://github.com/snowplow/snowplow/blob/master/5-data-modeling/sql-runner/redshift/sql/web-incremental/00-preparation/00-preparation.sql#L25
Gives this output
Can sql-runner be made to handle this edge case. It would also allow one to create playbooks for all initial schema and table setup.
The text was updated successfully, but these errors were encountered: