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

Is there a way to output script execution in a formatted way? #112

Closed
kjn70 opened this issue Apr 18, 2022 · 1 comment
Closed

Is there a way to output script execution in a formatted way? #112

kjn70 opened this issue Apr 18, 2022 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@kjn70
Copy link

kjn70 commented Apr 18, 2022

I'm still testing is schemachange can be a replacement for how we deploy code using snowsql today. In snowsql when code is run, our process automatically prefixes the code with the following snowsql commands so that we get a pretty, easy to audit log of what executed and the results of each executions.

!set exit_on_error=true
!set output_format=simple
!set remove_comments=False
!set timing=true
!set timing_in_output_file=true
!set echo=true
!set quiet=false

With schemachange currently, the output is harder to audit. For example:

Found Versioned file /builds/BPS_Database_DevOps/snowflake/cicdtesting-declarative/migrations/deploy/V2022.04.18.1__Deploy ingest objects.sql
Applying change script V2022.04.18.1__Deploy ingest objects.sql
Proceeding with private key authentication
SQL query: use schema ingest;
create or replace table test1 (col1 varchar);
use schema ingest;
create or replace table test2 (col1 varchar);
use schema ingest;
create or replace view view1
as select * from ingest.test1
Proceeding with private key authentication
SQL query: INSERT INTO CICD.DEV_CICDTESTING (VERSION, DESCRIPTION, SCRIPT, SCRIPT_TYPE, CHECKSUM, EXECUTION_TIME, STATUS, INSTALLED_BY, INSTALLED_ON) values ('2022.04.18.1','Deploy ingest objects','V2022.04.18.1__Deploy ingest objects.sql','V','99bd0eb49355f1c2c9fcc94b707c2b6d88a4582268ef6[189](https://---removed----)f5935c90',2,'Success','DEV_CICDTESTING_CICD_SVC',CURRENT_TIMESTAMP);
Successfully applied 1 change scripts (skipping 0)
Completed successfully

Is there a way to configure schemachange to adjust the formatting of the SQL execution and to return execution results, such as execution time and results?

An example of the output I get now is:

Executing from directory: D:\\GitLab-Runner\\builds\\VHxrjKBa\\0\\mitg_it\\mitg-bia\\script\\SNF\\BPS
/* ========= Place cut script below this line =============================================== */
/* === Build PUBLISH === */
-- Tables
!source DBObjects\3.PUBLISH\Tables\DEMO.sql
use database test_bps_db;
status                          
--------------------------------
Statement executed successfully.
1 Row(s) produced. Time Elapsed: 0.240s
use schema publish;
status                          
--------------------------------
Statement executed successfully.
1 Row(s) produced. Time Elapsed: 0.255s
create or replace table demo (col1 text);
status                          
--------------------------------
Table DEMO successfully created.
1 Row(s) produced. Time Elapsed: 0.237s
/* === END OF DATABASE CUT === */
!spool off
Goodbye!
============================================================================================
SUCCESS: Execution completed successfully
============================================================================================
@sfc-gh-tmathew sfc-gh-tmathew self-assigned this Sep 26, 2023
@sfc-gh-tmathew sfc-gh-tmathew added the duplicate This issue or pull request already exists label Sep 26, 2023
@sfc-gh-tmathew
Copy link
Collaborator

Hello @kjn70, Thank you for reaching out. The snowsql output looks great. There is no formatted output for schemachange at this time. However, I would track your request for formatted outputs in #104 to incorporate a formatted logging option.

For now, I will close this issue and track your request in issue #104.

Please reopen this one if you were looking for something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants