# Replace Dataset using Boto3 Quicksight API

**URL:** <https://community.amazonquick.com/t/replace-dataset-using-boto3-quicksight-api/6049>\
**Category:** Q&A\
**Tags:** api, data-source, developer, quick-sight\
**Created:** [September 14, 2022, 7:18pm UTC](https://community.amazonquick.com/t/replace-dataset-using-boto3-quicksight-api/6049 "2022-09-14T19:18:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![EduardoMelo](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@EduardoMelo](https://community.amazonquick.com/u/EduardoMelo)\
**Post date:** [September 14, 2022, 7:18pm UTC](https://community.amazonquick.com/t/replace-dataset-using-boto3-quicksight-api/6049/1 "2022-09-14T19:18:47Z")

</div>

Hi,  
I’m trying to create a template using [create\_template()]([QuickSight — Boto 3 Docs 1.11.4 documentation](https://boto3.amazonaws.com/v1/documentation/api/1.11.4/reference/services/quicksight.html#Quick) Sight.Client.create\_template), but instead of using the original datasets I want to use copies of those, which are CustomSQL queries.  
Would that be possible while at create\_template()?  
If not, would I be able to replace the datasets later maybe while update\_template() or, finally while create\_dashboard()?

---

<div class="post-metadata">

**Author:** ![tb102122](https://avatars.discourse-cdn.com/v4/letter/t/ce7236/32.png) [@tb102122](https://community.amazonquick.com/u/tb102122)\
**Post date:** [September 15, 2022, 11:00pm UTC](https://community.amazonquick.com/t/replace-dataset-using-boto3-quicksight-api/6049/2 "2022-09-15T23:00:37Z")

</div>

Hey Eduardo,  
yes it should be possible.  
In order to use templates cross accounts you first need to create the datasource in the the Accounts.  
We are using a longer powershell script to move all the datasets from our DEV account to the STAGE and PROD accounts. Within this step we are also modifying some the ARNs of linked resources like datasets, the process is the following

1. get the JSON definition in Account A
2. adjust JSON (replace your SQL)
3. deploy to Account B (you need to add logic to handle create and updates of the datasets for future updates)
