x89
x89

Reputation: 3450

No active warehouse selected in the current session - Select an active warehouse with the 'use warehouse' command

I am following this tutorial: https://quickstarts.snowflake.com/guide/data_engineering_with_dbt/#4

when I try to run this in a worksheet:

SELECT * 
  FROM "KNOEMA_ECONOMY_DATA_ATLAS"."ECONOMY"."DATASETS"
 WHERE "DatasetName" ILIKE 'US Stock%'
    OR "DatasetName" ILIKE 'Exchange%Rates%';

I get an error that No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command.

I am logged in as TESTUSER and as SECURITYADMIN role. I have also given necessary permissions:

enter image description here

What can I try? I tried to run this USE WAREHOUSE DBT_PROD_WH in a separate worksheet but it doesn't make any difference. I am not sure which warehouse I am supposed to use and with which role specifically

Upvotes: 2

Views: 13286

Answers (2)

FAB
FAB

Reputation: 2569

I've hit the same issue, following the same tutorial... basically there are no warehouses by default on the Snowflake account.

My approach was to identify how I can create/manage the warehouse in this case.

I've used the CREATE WAREHOUSE command (i.e. CREATE WAREHOUSE FIRST_WH)

This got automatically selected as my current warehouse after it was created: enter image description here

From there, just continue the tutorial.

Upvotes: 1

Lukasz Szozda
Lukasz Szozda

Reputation: 175566

The warehouse has to be set incontext of current session:

SELECT CURRENT_WAREHOUSE();

If it returns null then, it could be set up in WebUI. Using Worksheets for Queries - Overview of Features, setting the warehouse using item number 4

Dropdown menu:

Change the current database, schema, or warehouse for the current worksheet without losing your work.

Resume/suspend or resize your current warehouse.


Alternatively in the same worksheet:

USE WAREHOUSE <warehouse_name>;

SELECT * 
  FROM "KNOEMA_ECONOMY_DATA_ATLAS"."ECONOMY"."DATASETS"
 WHERE "DatasetName" ILIKE 'US Stock%'
    OR "DatasetName" ILIKE 'Exchange%Rates%';

Upvotes: 3

Related Questions