Datacamp Snowflake Course Flashcards

https://app.datacamp.com/learn/career-tracks/associate-data-engineer-in-snowflake (14 cards)

1
Q

In snowflake, an _ is created to reference the folder directory on cloud (like S3 bucket).

A

external stage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A table can be created pointing to the stage, that allows Snowflake to query data from cloud directory (mapped to the stage).
How to provide Snowflake permission to access cloud directory?

Assume required role with permission policy is already created in cloud (AWS).

A
  1. You need to create Storage Integration in Snowflake:
CREATE STORAGE INTEGRATION my_s3_integration
  TYPE = EXTERNAL_STAGE
  STORAGE_PROVIDER = S3
  ENABLED = TRUE
  STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::<your-account-id>:role/<your-role-name>'
  STORAGE_ALLOWED_LOCATIONS = ('s3://your-bucket/path/');
  1. Copy the STORAGE_AWS_IAM_USER_ARN and STORAGE_AWS_EXTERNAL_ID
DESC INTEGRATION my_s3_integration;
  1. Update trust policy by editing sts:ExternalId
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::<snowflake-account-id>:user/<snowflake-user>"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": {
          "sts:ExternalId": "<external-id-from-desc>"
        }
      }
    }
  ]
}

AWS_EXTERNAL_ID property from external stage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

create an external STAGE in Snowflake using STORAGE INTEGRATION.

A
CREATE OR REPLACE STAGE my_s3_stage
  URL = 's3://your-bucket/path/'
  STORAGE_INTEGRATION = my_s3_integration
  FILE_FORMAT = (TYPE = CSV);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Create an external table from external stage in Snowflake

A
CREATE OR REPLACE EXTERNAL TABLE my_ext_table (
  col1 STRING,
  col2 STRING
)
WITH LOCATION = @my_s3_stage
FILE_FORMAT = (TYPE = CSV);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Provide correct order of steps for loading data into Snowflake from a cloud provider.
* a) Create the stage.
* b) Refresh the stage.
* c) Create storage integration.
* d) Load data into table from stage
* e) Reference the stage in table creation

A
  1. c)
  2. a)
  3. b)
  4. e)
  5. d)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Two benefits of using Storage Integration:

A
  1. No need to pass AWS keys
  2. IAM role usage is trackable in AWS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

_ role has complete access to Snowflake account.

A

ACCOUNTADMIN

manages account-level tasks like billing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

_ role has privileges to create warehouses and databases (and other objects) in an account.

A

SYSADMIN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

_ role is dedicated to user and role management

A

USERADMIN

Can create users and roles in the account

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to assign a user the privilege to manage objects owned by the CUSTOM_ADMIN_HR role?

A

While creating the user, set the ‘Default Role’ field to CUSTOM_ADMIN_HR from the dropdown.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

You created a new warehouse that you want users with SYSADMIN role to be allowed to use. How will you achieve it?

A
  1. Click on warehouse. Under Privileges section, click to add privilege (+Privilege)
  2. Set role = SYSADMIN and Privilege = Usage
  3. Click on Grant Privilege.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Convert ‘80’ into number in Snowflake SQL.

A
  1. cast('80' as int)
  2. ‘80’::int
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Convert order_timestamp
(2015-01-01 11:38:36.000 -0800) to date.

A

cast(order_timestamp as date)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Capitalize each word of string in Snowflake SQL

A

INITCAP()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly