CREATE DATASHARE - Amazon Redshift

CREATE DATASHARE

Creates a new datashare in the current database. The owner of this datashare is the issuer of the CREATE DATASHARE command.

Amazon Redshift associates each datashare with a single Amazon Redshift database. You can only add objects from the associated database to a datashare. You can create multiple datashares on the same Amazon Redshift database.

For information about datashares, see Managing data sharing tasks.

To view information about the datashares, use SHOW DATASHARES.

Required privileges

Following are required privileges for CREATE DATASHARE:

  • Superuser

  • Users with the CREATE DATASHARE privilege

  • Database owner

Syntax

CREATE DATASHARE datashare_name
[[SET] PUBLICACCESSIBLE [=] TRUE | FALSE ];

Parameters

datashare_name

The name of the datashare. The datashare name must be unique in the cluster namespace.

[[SET] PUBLICACCESSIBLE]

A clause that specifies whether the datashare can be shared to clusters that are publicly accessible.

The default value for SET PUBLICACCESSIBLE is FALSE.

Usage notes

By default, the owner of the datashare only owns the share but not objects within the share.

Only superusers and the database owner can use CREATE DATASHARE and delegate ALTER privileges to other users or groups.

Examples

The following example creates the datashare salesshare.

CREATE DATASHARE salesshare;

The following example creates the datashare demoshare that AWS Data Exchange manages.

CREATE DATASHARE demoshare SET PUBLICACCESSIBLE TRUE, MANAGEDBY ADX;