This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {# | |
| Compresses the columns of a table to the specified encodings. Unlike the compress_table macro in dbt-redshift, | |
| you have to manually specify the encoding of the columns you want to compress, it does not run and use | |
| the result of `ANALYZE compression <table>` which would is extremely slow to run every time | |
| on a large table, especially when there is nothing to do and the table is already compressed. | |
| If the specified column does not exist or if the specified encoding is identical to the current encoding, | |
| the column is skipped. | |
| ALTER statements are generated for each column where encoding needs to be changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH table_columns AS ( | |
| SELECT | |
| c.relowner as tableowner | |
| ,n.nspname AS schema_name | |
| ,c.relname AS table_name | |
| ,a.attnum AS ordinal | |
| ,QUOTE_IDENT(a.attname) AS column_name | |
| ,CASE WHEN STRPOS(UPPER(format_type(a.atttypid, a.atttypmod)), 'CHARACTER VARYING') > 0 | |
| THEN REPLACE(UPPER(format_type(a.atttypid, a.atttypmod)), 'CHARACTER VARYING', 'VARCHAR') | |
| WHEN STRPOS(UPPER(format_type(a.atttypid, a.atttypmod)), 'CHARACTER') > 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE OR REPLACE FUNCTION f_add_business_day(start_date date, num_days integer) | |
| RETURNS date AS | |
| $BODY$ | |
| SELECT COALESCE( | |
| ( | |
| SELECT workdays.date | |
| FROM ( | |
| SELECT calendar.date::date, | |
| row_number() OVER (ORDER BY CASE WHEN num_days = abs(num_days) THEN calendar.date END, calendar.date DESC) as elapsed_days | |
| FROM generate_series( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Compile libvips and some of its needed dependencies to support jpeg,avif,webp,png and gif processing | |
| # This has not been tested extensively, so use at your own risk. | |
| # | |
| # This takes ~18min to compile on a t3.small, ~10min on a m6a.large | |
| # | |
| # TODO cleanup the flags everywhere to be consistent | |
| # | |
| set -ex |
OlderNewer