Git Product home page Git Product logo

1st-edition's People

Contributors

snowflakedefinitiveguide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

1st-edition's Issues

UDF function for factorial example does not work Pg 85

CREATE OR REPLACE FUNCTION FACTORIAL(n variant)
RETURNS variant LANGUAGE JAVASCRIPT AS
'var f=n;
for (i=n-1; i>0; i--) {
f=f*i}
return f';

The reason the above code works is because snowflake has in built function factorial. If you rename the function to Factorial_gt and run it like:
CREATE OR REPLACE FUNCTION FACTORIAL_GT(n variant)
RETURNS variant LANGUAGE JAVASCRIPT AS
'var f=n;
for (i=n-1; i>0; i--) {
f=f*i}
return f';
and try running it using SELECT FACTORIAL_GT(5)
you will get following stacktrace 100132 (P0000): JavaScript execution error: Uncaught ReferenceError: n is not defined in FACTORIAL_GT at 'var f=n;' position 6

Missing and Invalid code in Chapter 7, section 'Conditional Masking'

The section defines a masking policy, but does not provide the code to apply the masking policy to the table. Something like the following should be added:

ALTER TABLE DEMO7_DB.HRDATA.EMPLOYEES MODIFY COLUMN EMP_ID set masking policy DEMO7_DB.HRDATA.namemask using (EMP_ID, DEPT_ID);

The code for the masking policy namemask is:

CREATE OR REPLACE masking policy DEMO7_DB.HRDATA.namemask
AS (EMP_ID integer, DEPT_ID integer) returns integer ->
CASE WHEN current_role() = 'HR_ROLE'
then EMP_ID WHEN DEPT_ID = '100'
then EMP_ID
ELSE '**MASKED**' END;

When you select from the table, the following error message is generated:

Numeric value '**MASKED**' is not recognized

It appears the code for the masking policy should be something like:

CREATE OR REPLACE masking policy DEMO7_DB.HRDATA.namemask
AS (EMP_ID integer, DEPT_ID integer) returns integer ->
CASE WHEN current_role() = 'HR_ROLE'
then EMP_ID WHEN DEPT_ID = '100'
then EMP_ID
ELSE -99 END;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.