Wednesday, June 15, 2022

Microsoft Teams Takes forever to upload a file

Got annoyed with Teams taking forever to upload a simple file. 

Found that clearing Teams Cache would help and here are the steps to do so in Mac

1] Quit Teams

2] Go to Finder and get to ~/Library/Application Support/Microsoft

3] Delete the folder Teams from there

4] Go to Keychain Access App and search for Microsoft Teams and delete the entry.

5] Restart Teams 

Credit goes to: https://www.uvm.edu/it/kb/article/clearing-teams-cache/

Wednesday, March 23, 2022

Snowflake Constraint Column Details

 At the time of this post, Snowflake did not have any dictionary view that gives the column names for constraints that are defined for a table. 

So, here is what I found to get that list:

show primary keys; --and then get the query id from this and plug it in below query

select "database_name" db_name, "schema_name" schema_name, "table_name" table_name, "column_name" column_name, "key_sequence" key_seq
  from TABLE(RESULT_SCAN('query id from show command above'))
 where not "table_name" like any ('SAN_%', '%_STAGE', '%_STAGE_CLONE', 'BACKUP_%', 'raw_%', 't_raw_%', '_202%')
 order by 1,2,3,5;

Repeat same for unique keys and imported keys(foreign) 


Tuesday, June 1, 2021

awk - Exclude or Include Records from a fixed-width file

The below command gets the records that have a value "new" in the given position (in this case the file was fixed-width). All other records which do not have the value "new" are ignored.

 awk '{if (substr($0, 7, 3) == "new") print $0}' file1.txt

substr 7, 3 is the starting position 7 with 3 characters