# Script to generate SQL to delete SME analytics products
This script will generate SQL to hard delete a list of products that are passed in.
We have situations where we want to delete products (such as SME analytics products being moved to new labels).
In those situations it has been deemed too dangerous to make a direct jenkins job for deletions,
so this is to assist with creating DB PRs until we have a proper migration strategy. In theory this can be used
for any case where we need to hard delete a product, however it does NOT handle analytics or accounting data,
which is not an issue for these SME analytics products. For the time being this is not deployed anywhere and is
to be run locally, but we should be able to put this on jenkins scheduler.

## With Docker
```
cp .env.shadow .env
```
Then update the art_relations database credentials in .env file to user reportsAR (this is read-only)
```
docker compose run --build generate-delete-products-sql release_id1 release_id2....
```
Copy the printed SQL and create a database PR with it

## Without Docker:

### Installation
```
python3 -m venv env
```
```
source env/bin/activate
```
```
pip install -r requirements.txt
```
```
cp .env.shadow .env
```

Then update the art_relations database credentials in .env file to user reportsAR (this is read-only)

### Running the script
run the script by running following command providing the list of product ids as given below:
```
python main.py 12345 54321
```
Copy the printed SQL and create a database PR with it
