Snowflake-Labs / schemachange

A Database Change Management tool for Snowflake
Apache License 2.0
481 stars 219 forks source link

Role names containing dashes #186

Open TLI-BAY opened 11 months ago

TLI-BAY commented 11 months ago

https://github.com/Snowflake-Labs/schemachange/blob/2eb5d52b3aa5597465a9478b2a4e35dd913d0e17/schemachange/cli.py#L210C1-L210C1

In case role names contain dashes this leads to a sql error. At the moment additional escaped quotes must be provided in order to get it running. Would be really nice if quotes would be added by default to cover this scenario.

In schemachange 3.4.2 it worked without extra quotes (on snowflake-python-connector 2.8.1) In the current version of schemachange (3.5.3) extra quotes have to be added manually (on snowflake-python-connector 3.0.4)

TLI-BAY commented 11 months ago

In case someone else has the same issue using github actions env, I have provided the role names like this:

[KEY NAME]: "\"[ROLE NAME]\""

sfc-gh-twhite commented 10 months ago

Thank you for raising this one! There may be an opportunity to add IDENTIFIER syntax on SQL statements throughout the source. An example might be something like:

cursor.execute(f"ALTER USER IDENTIFIER(%s) SET LAST_NAME = %s", ('J_DOE', 'DOE'))

I think it takes care of the special characters.

dwelden commented 9 months ago

An option to omit role and leverage the specified user's default role would also be welcome.

dwelden commented 7 months ago

Is there any update on whether this issue will be resolved or closed?

Canapfeeder commented 5 months ago

Hi all, I think this is supposed to be in 3.6.2 release ? When is this supposed to be released ?