

 Amazon Redshift will no longer support the creation of new Python UDFs starting Patch 198. Existing Python UDFs will continue to function until June 30, 2026. For more information, see the [ blog post ](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/). 

# Producer actions for existing datashares in Amazon Redshift
<a name="writes-producer-existing"></a>

With Amazon Redshift, you can manage existing datashares to control access to your data in an Amazon Redshift cluster. The following sections provide step-by-step guidance on modifying datashare objects, managing datashare permissions, and updating datashare properties to effectively control and audit data access in your Amazon Redshift environment.

**Topics**
+ [Viewing a datashare in Amazon Redshift](writes-viewing.md)
+ [Editing datashares created in your account in Amazon Redshift](writes-editing.md)
+ [Removing authorization from a datashare in Amazon Redshift](writes-removing-authorization.md)
+ [Removing datashare objects from a datashare in Amazon Redshift](writes-removing-datashare-object.md)
+ [Removing data consumers from a datashare in Amazon Redshift](writes-removing-data-consumer.md)
+ [Deleting a datashare created in your account in Amazon Redshift](writes-deleting.md)

# Viewing a datashare in Amazon Redshift
<a name="writes-viewing"></a>

You can view datashares from the console or with SQL. 

------
#### [ Console ]

You can view datashares from the **Datashares** or **Clusters** tab.
+ Use the **Datashares** tab to list datashares in your account or from other accounts.
  + To view datashares created in your account, choose **In my account**, then choose the datashare you want to view.
  + To view datashares that are shared from other accounts, choose **From other accounts**, then choose the datashare you want to view.
+ Use the **Clusters** tab to list datashares in your cluster or from other clusters.

  First, connect to a database. Then, choose a datashare either from the **Datashares from other clusters** or **Datashares created in my cluster** section to view its details.

------
#### [ SQL ]

You can list datashares created in the cluster and look into the contents of the datashare.

The following example displays the information of a datashare named `salesshare`. 

```
DESC DATASHARE salesshare;
               
 producer_account  |          producer_namespace          | share_type | share_name | object_type |           object_name          |   include_new
-------------------+--------------------------------------+------------+------------+-------------+--------------------------------+-------------------
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_users_redshift   |   
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_venue_redshift   |
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_category_redshift|
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_date_redshift    |
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_event_redshift   |
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_listing_redshift |
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | table       | public.tickit_sales_redshift   |
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | schema      | public                         |  t
 123456789012      | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d | OUTBOUND   | salesshare | view        | public.sales_data_summary_view |
```

The following example displays the outbound datashares in a producer cluster.

```
SHOW DATASHARES LIKE 'sales%';
```

The output looks similar to the following.

```
share_name | share_owner  | source_database | consumer_database | share_type |     createdate      | is_publicaccessible  | share_acl | producer_account |          producer_namespace 
-----------+--------------+-----------------+-------------------+------------+---------------------+----------------------+-----------+------------------+---------------------------------------
salesshare |    100       | dev             |                   |  OUTBOUND  | 2020-12-09 02:27:08 |          True        |           |   123456789012   | 13b8833d-17c6-4f16-8fe4-1a018f5ed00d
```

For more information, see [DESC DATASHARE](r_DESC_DATASHARE.md) and [SHOW DATASHARES](r_SHOW_DATASHARES.md). 

You can also use [SVV\$1DATASHARES](r_SVV_DATASHARES.md), [SVV\$1DATASHARE\$1CONSUMERS](r_SVV_DATASHARE_CONSUMERS.md), and [SVV\$1DATASHARE\$1OBJECTS](r_SVV_DATASHARE_OBJECTS.md) to view the datashares, the objects within the datashare, and the datashare consumers.

------

# Editing datashares created in your account in Amazon Redshift
<a name="writes-editing"></a>

You can edit a datashare created in your account using the console and with SQL.

------
#### [ Console ]

On the console, take the following steps to connect to a database first to see the list of datashares created in your account.

1. Sign in to the AWS Management Console and open the Amazon Redshift console at [https://console.aws.amazon.com/redshiftv2/](https://console.aws.amazon.com/redshiftv2/).

1. On the navigation menu, choose **Clusters**, then choose your cluster. The cluster details page appears.

1. Choose **Datashares**.

1. In the **Datashares created in my account** section, choose **Connect to database**.

1. Choose the datashare you want to edit, then choose **Edit**. The datashare details page appears.

1. Make any changes in the **Datashare objects** or **Data consumers** section.

1. Choose **Save changes**. Amazon Redshift updates your datashare with the changes.
**Note**  
If you chose to publish your datashare to the AWS Glue Data Catalog, you can't edit the configuration to publish the datashare to other Amazon Redshift accounts.

------
#### [ SQL ]

Use ALTER DATASHARE to remove objects from datashares at any point from the datashare. To remove a schema, use the following command:

```
ALTER DATASHARE salesshare REMOVE SCHEMA PUBLIC;
```

To remove a table, use the following command:

```
ALTER DATASHARE salesshare REMOVE TABLE public.tickit_sales_redshift;
```

Use REVOKE USAGE ON to revoke permissions on the datashare to certain consumers. It revokes USAGE permissions on objects within a datashare and instantly stops access to all consumer clusters. Listing datashares and the metadata queries, such as listing databases and tables, doesn't return the shared objects after access is revoked. Revoke access to the datashare from namespaces if you don't want to share the data with the consumers anymore.

```
REVOKE USAGE ON DATASHARE salesshare FROM NAMESPACE '13b8833d-17c6-4f16-8fe4-1a018f5ed00d';
```

If you don't want to share the data with the consumers anymore, revoke access to the datashare from AWS accounts:

```
REVOKE USAGE ON DATASHARE salesshare FROM ACCOUNT '123456789012';
```

------

# Removing authorization from a datashare in Amazon Redshift
<a name="writes-removing-authorization"></a>

With Amazon Redshift, you can control access to datashares by revoking authorization for specified consumers. This sections provides instructions for revoking consumer access to your datashares in Amazon Redshift.

**Note**  
To remove authorization for the datashare, there must be at least one data consumer added to the datashare.

------
#### [ Console ]

Choose one or more consumer clusters that you want to remove authorization from. Then, choose **Remove authorization**.

After authorization is removed, data consumers lose access to the datashare immediately.

------
#### [ API ]

The producer security administrator determines the following:
+ Whether or not another account can have access to the datashare.
+ If an account has access to the datashare, whether or not that account has write permissions.

The following IAM permissions are required to deauthorize a datashare: 

**redshift:DeauthorizeDataShare**

You can deauthorize usage and writes using either a CLI call or with the API:

```
deauthorize-data-share
--data-share-arn <value>
--consumer-identifier <value>
```

For more information about the command, see [deauthorize-data-share](https://docs.aws.amazon.com/cli/latest/reference/redshift/deauthorize-data-share.html).

------

# Removing datashare objects from a datashare in Amazon Redshift
<a name="writes-removing-datashare-object"></a>

You can remove one or more objects from a datashare by using the following procedure.

------
#### [ Console ]

To remove one or more objects from a datashare on the consoe, follow these steps.

1. Sign in to the AWS Management Console and open the Amazon Redshift console at [https://console.aws.amazon.com/redshiftv2/](https://console.aws.amazon.com/redshiftv2/).

1. On the navigation menu, choose **Clusters**, then choose your cluster. The cluster details page appears.

1. Choose **Datashares**.

1. In the **Datashares created in my account** section, choose **Connect to database**. For more information, see [Connecting to a database](connect-database-console.md).

1. Choose the datashare you want to edit, then choose **Edit**. The datashare details page appears.

1. To remove one or more datashare objects to the datashare, do one of the following:
   + To remove schemas from the datashare, choose one or more schemas. Then choose **Remove**. Amazon Redshift removes the specified schemas and all the objects of the specified schemas from the datashare.
   + To remove tables and views from the datashare, choose one or more tables and views. Then choose **Remove**. Alternatively, choose **Remove by schema** to remove all tables and views in the specified schemas.
   + To remove user-defined functions from the datashare, choose one or more user-defined functions. Then choose **Remove**. Alternatively, choose **Remove by schema** to remove all user-defined functions in the specified schemas.

------
#### [ SQL ]

Use ALTER DATASHARE to remove objects from datashares at any point from the datashare. To remove a schema, use the following command:

```
ALTER DATASHARE salesshare REMOVE SCHEMA PUBLIC;
```

To remove a table, use the following command:

```
ALTER DATASHARE salesshare REMOVE TABLE public.tickit_sales_redshift;
```

------

# Removing data consumers from a datashare in Amazon Redshift
<a name="writes-removing-data-consumer"></a>

You can remove one or more data consumers from a datashare. Data consumers can be namespaces that uniquely identified Amazon Redshift clusters or AWS accounts.

------
#### [ Console ]

To remove one or more data consumers from a datashare on the console, choose one or more data consumers either from the namespace IDs or AWS account. Then, choose **Remove**.

Amazon Redshift removes the specified data consumers from the datashare. They lose access to the datashare immediately.

------
#### [ SQL ]

Use REVOKE USAGE ON to revoke permissions on the datashare to certain consumers. It revokes USAGE permissions on objects within a datashare and instantly stops access to all consumer clusters. Listing datashares and the metadata queries, such as listing databases and tables, doesn't return the shared objects after access is revoked. Revoke access to the datashare from namespaces if you don't want to share the data with the consumers anymore.

```
REVOKE USAGE ON DATASHARE salesshare FROM NAMESPACE '13b8833d-17c6-4f16-8fe4-1a018f5ed00d';
```

------

# Deleting a datashare created in your account in Amazon Redshift
<a name="writes-deleting"></a>

You can delete a datashare created in your account using the console or with SQL.

------
#### [ Console ]

To delete a datashare created in your account using the console, first connect to a database to see the list of datashares created in your account.

1. Sign in to the AWS Management Console and open the Amazon Redshift console at [https://console.aws.amazon.com/redshiftv2/](https://console.aws.amazon.com/redshiftv2/).

1. On the navigation menu, choose **Clusters**, then choose your cluster. The cluster details page appears.

1. Choose **Datashares**. The datashare list appears.

1. In the **Datashares created in my account** section, choose **Connect to database**.

1. Choose one or more datashares you want to delete, then choose **Delete**. The Delete datashares page appears.

   Deleting a datashare shared with Lake Formation doesn't automatically remove the associated permissions in Lake Formation. To remove them, go to the Lake Formation console.

1. Type **Delete** to confirm deleting the specified datashares.

1. Choose **Delete**.

After datashares are deleted, datashare consumers lose access to the datashares.

------
#### [ SQL ]

You can use SQL to delete the datashare objects at any point using [DROP DATASHARE](r_DROP_DATASHARE.md). Cluster superusers and owners of datashare can drop datashares.

The following example drops a datashare named `salesshare`.

```
DROP DATASHARE salesshare;
```

------