Skip to content
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

Issue in sync({alter: true}) with snowflake dialect #15525

Open
3 of 6 tasks
bhushangoel opened this issue Jan 4, 2023 · 1 comment
Open
3 of 6 tasks

Issue in sync({alter: true}) with snowflake dialect #15525

bhushangoel opened this issue Jan 4, 2023 · 1 comment
Labels
dialect: snowflake For issues and PRs. Things that involve Snowflake (and do not involve all dialects). type: bug

Comments

@bhushangoel
Copy link

Issue Creation Checklist

  • I understand that my issue will be automatically closed if I don't fill in the requested information
  • I have read the contribution guidelines

Bug Description

I am using sequelize with snowflake dialect and when I am trying to change schema for any existing column by using sync({ alter: true }) I am getting the following error

Executing (default): SHOW FULL COLUMNS FROM "TEST_BG";

DatabaseError [SequelizeDatabaseError]: SQL compilation error:
syntax error line 1 at position 5 unexpected 'FULL'.

This is because on using alter: true SHOW FULL COLUMNS query gets executed but snowflake doesn't support this.
Instead snowflake supports SHOW COLUMNS IN ${table};

You can refer to this link(https://docs.snowflake.com/en/sql-reference/sql/show-columns.html)

Reproducible Example

Here is the link to the SSCCE for this issue:

What do you expect to happen?

What is actually happening?

I am using sequelize with snowflake dialect and when I am trying to change schema for any existing column by using sync({ alter: true }) I am getting the following error

Executing (default): SHOW FULL COLUMNS FROM "TEST_BG";

DatabaseError [SequelizeDatabaseError]: SQL compilation error:
syntax error line 1 at position 5 unexpected 'FULL'.
    at Query.formatError (C:\projects\snowflake\node-poc\node_modules\sequelize\lib\dialects\snowflake\query.js:207:16)
    at Query.run (C:\projects\snowflake\node-poc\node_modules\sequelize\lib\dialects\snowflake\query.js:57:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async C:\projects\snowflake\node-poc\node_modules\sequelize\lib\sequelize.js:314:16
    at async SnowflakeQueryInterface.describeTable (C:\projects\snowflake\node-poc\node_modules\sequelize\lib\dialects\abstract\query-interface.js:166:20)
    at async Promise.all (index 0)
    at async TEST_BG.sync (C:\projects\snowflake\node-poc\node_modules\sequelize\lib\model.js:947:26)
    at async Sequelize.sync (C:\projects\snowflake\node-poc\node_modules\sequelize\lib\sequelize.js:376:9)
    at async C:\projects\snowflake\node-poc\src\main.ts:47:3

This is because on using sequelize.sync({ alter: true }); SHOW FULL COLUMNS query gets executed but snowflake doesn't support this.
Instead snowflake supports SHOW COLUMNS IN ${table};

You can refer to this link (https://docs.snowflake.com/en/sql-reference/sql/show-columns.html)

Environment

  • Sequelize version: 6.28.0
  • Node.js version:
  • If TypeScript related: TypeScript version:
  • Database & Version: snowflake
  • Connector library & Version:

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I will need guidance.
  • No, I don't have the time, but my company or I are supporting Sequelize through donations on OpenCollective.
  • No, I don't have the time, and I understand that I will need to wait until someone from the community or maintainers is interested in resolving my issue.

Indicate your interest in the resolution of this issue by adding the 👍 reaction. Comments such as "+1" will be removed.

@bhushangoel bhushangoel added pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet type: bug labels Jan 4, 2023
@WikiRik
Copy link
Member

WikiRik commented Jan 4, 2023

We're completely dependent on community support for snowflake since we do not have access to an instance to run integration tests. Therefore we would happily accept a PR from you to solve this issue

@WikiRik WikiRik added dialect: snowflake For issues and PRs. Things that involve Snowflake (and do not involve all dialects). and removed pending-approval Bug reports that have not been verified yet, or feature requests that have not been accepted yet labels Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialect: snowflake For issues and PRs. Things that involve Snowflake (and do not involve all dialects). type: bug
Projects
None yet
Development

No branches or pull requests

2 participants