Skip to content
Storage

Register and use an external dataset

Register a Snowflake schema or BigQuery dataset as an external dataset, keep it refreshed, query it in SQL, share it with other projects, or remove it.

These are the tasks around an external dataset: register a schema or dataset from your own warehouse, refresh it, query it, share it and remove it. Where Snowflake and BigQuery differ, pick your backend in a tab. The other tab groups on the page switch with it.

Goal: make a schema or dataset of your warehouse available as a read-only bucket in the project.

An external dataset can be registered in the Storage of a project. The dialog will differ based on the backend you are using.

  1. Go to Storage > Register External Data.
  2. Fill in the name of the new bucket, database name, and schema name. Click Next Step.
  3. Keboola then shows GRANT statements for your database and schema. Log in to Snowflake (for example, open a worksheet) with a role that can grant USAGE on the database and schema and SELECT on all and future tables and views in the schema, and run the statements.
  4. Once access has been granted, click Register Dataset to start using it.

Result: When you register an external dataset, we analyze the metadata of the objects in it and register all tables and views as tables in the Keboola Storage bucket.

Goal: make tables or views that were added after the registration visible in Keboola.

If you later add additional tables or views, you must manually refresh the Storage bucket using the Refresh action in the bucket detail to make them visible in Keboola.

  1. Open the bucket detail of the external dataset.

  2. Use the Refresh action.

    Bucket refresh

Result: The added tables and views are visible in Keboola. For table and column descriptions, see Using an external dataset.

Goal: keep the bucket in sync with the source schema without refreshing it by hand.

You can enable Auto-refresh for external buckets using a cron scheduler. Auto-refresh ensures that your external dataset remains synced with the source schema and prevents pipelines from failing due to outdated metadata.

  1. To configure Auto-refresh, open the bucket detail and click Setup next to Auto-refresh.

    Auto-refresh configuration

  2. In Auto-refresh Settings, choose how often under Every (for example Day) and the time under at (Hours, Minutes). Times are in UTC; Schedule Preview lists the next runs. Click Add. The schedule appears under Scheduled Tasks, where Delete removes it.

    Auto-refresh schedule

Result: The bucket metadata is refreshed automatically on the schedule you set.

Keep read-only input mapping access to recreated tables

Section titled “Keep read-only input mapping access to recreated tables”

Goal: keep the read-only input mapping able to read a table that was deleted and created again in the source schema.

A refresh of the bucket restores the access each time (see Limitations). To permanently resolve this issue, you can manually grant the read-only input mapping role future access to your tables and views:

  1. Run these statements in Snowflake:

    GRANT SELECT ON FUTURE TABLES IN SCHEMA "REPORTING"."sales_schema" TO ROLE KEBOOLA_8_RO;
    GRANT SELECT ON FUTURE VIEWS IN SCHEMA "REPORTING"."sales_schema" TO ROLE KEBOOLA_8_RO;
    GRANT SELECT ON FUTURE EXTERNAL TABLES IN SCHEMA "REPORTING"."sales_schema" TO ROLE KEBOOLA_8_RO;
  2. Replace "REPORTING"."sales_schema" with your database and schema, and KEBOOLA_8_RO with the read-only role of your project. Ensure the role name follows the pattern KEBOOLA_<PROJECT_ID>_RO given in Read-only access to project storage and is suffixed with _RO.

Result: The read-only role can read tables and views created in the schema later, so a recreated table stays readable.

Query an external dataset in a SQL transformation

Section titled “Query an external dataset in a SQL transformation”

Goal: read a table of an external dataset in a transformation.

External datasets can be used in an input mapping (see Using an external dataset). You can also reference them in your transformation by a fully qualified name, as in this example.

In the following example, it is assumed that you’ve created an external dataset called users_reporting that references the sales_emea schema in the database REPORTING. The schema contains a table called users. Now you want to create a new table MQL_USERS that contains only users sourced from marketing-qualified leads. You can do that using the following SQL:

CREATE TABLE "MQL_USERS" AS SELECT *
FROM "REPORTING"."sales_emea"."users"
WHERE "source" = 'mql';

Result: The transformation creates the table MQL_USERS from the rows it reads in the external dataset.

Goal: let other projects read the external dataset.

It is possible to share an external dataset using the same process as any other Storage bucket.

Sharing a Snowflake external dataset works out of the box — no additional configuration is required beyond the standard bucket sharing flow.

Result: Once the bucket is shared, the refresh operation is only available in the source project (the project where the external dataset was registered). Currently, it is possible to share entire buckets, not specific tables within them.

Goal: take the external dataset out of the project.

Removing an external dataset is as simple as removing any other Storage bucket.

  1. In Storage, open the ⋯ menu of the bucket and choose Delete bucket, or call the Storage API: DELETE /v2/storage/buckets/{bucket_id}.

Result: The Storage bucket will be removed from the project, but the schema in the database will remain untouched. Any rights that you have granted to Keboola during the registration will be revoked.

If you wish to remove the schema, you must do so manually in your warehouse.


Next: Import a Snowflake share →

Ask Kai

Hi, I'm Kai — Keboola's AI assistant for the docs. Ask me anything and I'll answer from the documentation and cite the pages I use.

Kai is an AI and can make mistakes. Check the sources it links.