-
Notifications
You must be signed in to change notification settings - Fork 427
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
fix: read Name, Database and Schema during Procedure import #819
Conversation
Update ReadProcedure() to set name, database and schema from Show during import. Remove the RETURN argument from ArgumentsSignature() because it is not part of the unqiue signature of a procedure and will not exist during import unless the ID is updated to include it. Change default value of comment to 'user-defined procedure' and fix corresponding tests.
Refactor ArgumentsSignature(), not only removing the RETURN but also capitalizing the entire output to match the output of the SHOW statement. Refactor unit test for Read to more thoroughly test reading the existing procedure with the minimal initial values provided. Update acceptance test to include testing an import.
@@ -230,7 +230,7 @@ type procedure struct { | |||
Name sql.NullString `db:"name"` | |||
SchemaName sql.NullString `db:"schema_name"` | |||
Text sql.NullString `db:"text"` | |||
DatabaseName sql.NullString `db:"database_name"` | |||
DatabaseName sql.NullString `db:"catalog_name"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, Snowflake returns the database name in a column called catalog_name
when calling the SHOW PROCEDURES query.
https://docs.snowflake.com/en/sql-reference/sql/show-procedures.html#output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well that's weird and not uniform...
/ok-to-test sha=4640860 |
Integration tests success for 4640860 |
/ok-to-test sha=1ef9ac4 |
Integration tests success for 1ef9ac4 |
Update ReadProcedure() to set name, database and schema during import.
Refactor ArgumentsSignature() to both remove the RETURN portion and to
uppercase the output. The RETURN is technically not part of the unique signature
of a procedure and will not exist when performing an import unless the ID
is updated to include it. Uppercasing the output means the signature will match
the output of the Snowflake SHOW command.
Change default value of comment to
user-defined procedure
.Refactor unit test for Read to more thoroughly test reading an existing procedure
with the minimal initial values provided as would be the case during an import.
Update acceptance test to include testing an import.
Test Plan
References
"stored procedures are identified and resolved by the combination of the name and argument types"