diff --git a/CHANGELOG.md b/CHANGELOG.md index ad0ccff19..8000d888a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ CARTO Analytics Toolbox Core. All notable commits to this project will be documented in this file. +## 2024-09-23 + +- feat(sf): added warehouse option for SF (#524) +- chore(bq): increse jest timeout to 30000 (#525) +- docs(sf): add docs on how to update the analytics toolbox from a native app (#527) +- chore(sf): update python version on stored procedures from 3.8 to 3.9 (#528) + ## 2024-08-22 - chore(rs): bump scipy from 0.12.0 to 0.12.1 in /clouds/redshift/libraries/python (#518) diff --git a/clouds/bigquery/modules/Makefile b/clouds/bigquery/modules/Makefile index 521fe1ce2..61892d7b8 100644 --- a/clouds/bigquery/modules/Makefile +++ b/clouds/bigquery/modules/Makefile @@ -85,7 +85,7 @@ test: check $(NODE_MODULES_DEV) if [ ! -z "$$TESTS" ]; then \ GOOGLE_APPLICATION_CREDENTIALS=$(GOOGLE_APPLICATION_CREDENTIALS) \ PATH="$(NODE_MODULES_DEV)/.bin/:$(PATH)" \ - jest --testTimeout=250000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$TESTS \ + jest --testTimeout=300000 $(BAIL) --verbose --slowTestThreshold=20 --maxConcurrency=10 $$TESTS \ --setupFilesAfterEnv "$(COMMON_DIR)/test-extend.js" || exit 1; \ OLD_TEST=$(TEST_DIR)/$$m/old-test; \ if [ -d $$OLD_TEST ]; then \ diff --git a/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql b/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql index 93b69f8b9..9372273b8 100644 --- a/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql +++ b/clouds/bigquery/modules/sql/quadbin/QUADBIN_POLYFILL.sql @@ -76,9 +76,9 @@ RETURNS INT64 AS (( WITH __geog_area AS ( SELECT + 508164597540055.75 AS q0_area, ST_AREA(geog) AS geog_area, - COS(ST_Y(ST_CENTROID(geog)) * ACOS(-1) / 180) AS cos_geog_lat, - 508164597540055.75 AS q0_area + COS(ST_Y(ST_CENTROID(geog)) * ACOS(-1) / 180) AS cos_geog_lat ) -- compute the resolution of cells that match the geog area SELECT IF(geog_area > 0 AND cos_geog_lat > 0, diff --git a/clouds/snowflake/.env.template b/clouds/snowflake/.env.template index 0bfa4262b..967be5aa0 100644 --- a/clouds/snowflake/.env.template +++ b/clouds/snowflake/.env.template @@ -13,3 +13,4 @@ SF_USER= SF_PASSWORD= SF_ROLE= # optional SF_SHARE= # optional +SF_WAREHOUSE= # optional diff --git a/clouds/snowflake/CHANGELOG.md b/clouds/snowflake/CHANGELOG.md index 176a981d9..cd3735e94 100644 --- a/clouds/snowflake/CHANGELOG.md +++ b/clouds/snowflake/CHANGELOG.md @@ -4,9 +4,15 @@ CARTO Analytics Toolbox Core for Snowflake. All notable commits to this project will be documented in this file. +## [1.2.5] - 2024-09-23 + +- feat: added warehouse option for SF (#524) +- docs: add docs on how to update the analytics toolbox from a native app (#527) +- chore: update python version on stored procedures from 3.8 to 3.9 (#528) + ## [1.2.4] - 2024-06-27 -- chore(sf): refactor at snowflake native app to an installer (#512) +- chore: refactor at snowflake native app to an installer (#512) ## [1.2.3] - 2024-05-21 diff --git a/clouds/snowflake/README.md b/clouds/snowflake/README.md index d87854d61..2cd72ac99 100644 --- a/clouds/snowflake/README.md +++ b/clouds/snowflake/README.md @@ -24,6 +24,7 @@ SF_USER= SF_PASSWORD= SF_ROLE= # optional SF_SHARE= # optional +SF_WAREHOUSE= # optional ``` ## Structure diff --git a/clouds/snowflake/common/run-query.js b/clouds/snowflake/common/run-query.js index e5274e112..e9c0ef6eb 100755 --- a/clouds/snowflake/common/run-query.js +++ b/clouds/snowflake/common/run-query.js @@ -8,7 +8,8 @@ const connection = snowflake.createConnection({ account: process.env.SF_ACCOUNT, username: process.env.SF_USER, password: process.env.SF_PASSWORD, - role: process.env.SF_ROLE + role: process.env.SF_ROLE, + warehouse: process.env.SF_WAREHOUSE }); connection.connect((err) => { diff --git a/clouds/snowflake/common/run-script.js b/clouds/snowflake/common/run-script.js index 902808742..55d015c93 100755 --- a/clouds/snowflake/common/run-script.js +++ b/clouds/snowflake/common/run-script.js @@ -18,7 +18,8 @@ const connection = snowflake.createConnection({ account: process.env.SF_ACCOUNT, username: process.env.SF_USER, password: process.env.SF_PASSWORD, - role: process.env.SF_ROLE + role: process.env.SF_ROLE, + warehouse: process.env.SF_WAREHOUSE }); connection.connect((err) => { diff --git a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql index e56c62d90..cf4b8ce49 100644 --- a/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql +++ b/clouds/snowflake/modules/sql/quadbin/QUADBIN_FROMLONGLAT.sql @@ -53,4 +53,3 @@ AS $$ SELECT @@SF_SCHEMA@@._QUADBIN_STRING_TOINT(@@SF_SCHEMA@@._QUADBIN_FROMZXY(z, x, y)) FROM __zxy $$; - diff --git a/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql b/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql index 6e0dcf188..17bcf8990 100644 --- a/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql +++ b/clouds/snowflake/modules/sql/quadbin/QUADBIN_TOPARENT.sql @@ -47,4 +47,4 @@ AS $$ resolution * 2 ) ) -$$; \ No newline at end of file +$$; diff --git a/clouds/snowflake/native_app/README.md b/clouds/snowflake/native_app/README.md index 36764875d..2a35ba16b 100644 --- a/clouds/snowflake/native_app/README.md +++ b/clouds/snowflake/native_app/README.md @@ -47,6 +47,26 @@ GRANT USAGE ON FUTURE PROCEDURES IN SCHEMA CARTO.CARTO TO ROLE PUBLIC; CALL CARTO.CARTO.INSTALL('CARTO_ANALYTICS_TOOLBOX', 'CARTO.CARTO'); ``` +##### * Update the Analytics Toolbox + +When a new package of the Analytics Toolbox gets released, the Analytics Toolbox installer gets updated automatically. As in the first installation most of the required permissions were already set, only the next queries should be necessary in order to update the Analytics Toolbox. + +``` +-- Set admin permissions +USE ROLE ACCOUNTADMIN; + +-- Generate the installer procedure in the specified location +CALL CARTO_ANALYTICS_TOOLBOX.CARTO.GENERATE_INSTALLER('CARTO.CARTO'); + +-- Update ownership of the install procedure +GRANT OWNERSHIP ON PROCEDURE CARTO.CARTO.INSTALL(STRING, STRING) TO ROLE ACCOUNTADMIN REVOKE CURRENT GRANTS; + +-- Install the Analytics Toolbox in CARTO.CARTO +CALL CARTO.CARTO.INSTALL('CARTO_ANALYTICS_TOOLBOX', 'CARTO.CARTO'); +``` + +If your Analytics Toolbox doesn't get updated properly please try to drop the app, get it back from Snowflake Marketplace and follow the Step 1. + ### Usage Examples Please refer to CARTO's [SQL reference](https://docs.carto.com/data-and-analysis/analytics-toolbox-for-snowflake/sql-reference) to find the full list of available functions and procedures as well as examples. diff --git a/clouds/snowflake/native_app/SETUP_SCRIPT.sql b/clouds/snowflake/native_app/SETUP_SCRIPT.sql index 967e3204d..9983f186f 100644 --- a/clouds/snowflake/native_app/SETUP_SCRIPT.sql +++ b/clouds/snowflake/native_app/SETUP_SCRIPT.sql @@ -1,7 +1,7 @@ CREATE OR REPLACE PROCEDURE @@SF_APP_SCHEMA@@.GET_MODULES_SQL_FROM_STAGE() returns string language python - runtime_version = '3.8' + RUNTIME_VERSION = '3.9' packages = ('snowflake-snowpark-python') imports = ( '/get_modules_sql_from_stage.py', diff --git a/clouds/snowflake/version b/clouds/snowflake/version index e8ea05db8..c813fe116 100644 --- a/clouds/snowflake/version +++ b/clouds/snowflake/version @@ -1 +1 @@ -1.2.4 +1.2.5