Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

If you need to know how to completely remove a weather source in Chameleon, you’ve come to the right place. As of February 2020, there isn’t a way to do this without using direct MySQL database manipulations. Perhaps someday we’ll enable this via a Flow feature.

Quick-remove the Community Weather Source

If you want to remove the Community weather source your first step should be to

STOP incoming data from the Community Reader by removing the Community Weather as a source in Flow.

Then this script can be used to clean out the old data. You might want to do it a step at a time.

-- declare some variables to use to identify our Community Weather Data source
SET NAMES 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';
set @appGuid = '17769838-2D41-4331-B62E-7B610DA1E84E'; -- Community
set @dataType = 'Weather';
set @sourceId = 999;

-- these statements find and display the selected data source
SELECT @sourceId := `ID` FROM `data_source` WHERE `app_guid`=@appGuid AND `data_type`=@dataType;
SELECT `ID`, `name`, `short_name`, `data_type`, IFNULL(`customID`, '') CustomId FROM `data_source` WHERE `ID` = @sourceId;

-- after you confirm we have the right one - go ahead and run the delete statements to remove
DELETE FROM `data_source` WHERE `ID` = @sourceID;
DELETE FROM `weather` WHERE `setName` = 'Community';

Generic - Remove a Weather Source

Step 0 - Stop the Reader

First you should stop the reader that is the source of the data you are wanting to remove. Having it running can only complicate things while we do this.

Step 1 - Identify Data_Source record

First you need to find and note the ID of the data_source record.

SELECT * FROM data_source where data_type = 'Weather';

Step 2 - Remove Data_Source record

You can delete it with a SQL command: (replace ## with the data_source ID value)

delete from data_source where ID = ##;

Or you can delete it in MySQL Workbench. After you’ve viewed the table

  • right-click on the record to be deleted

  • click on Delete Row(s)

  • Then click on the [Apply] button (closer to the bottom right)

  • Confirm the delete

Step 3 - Remove weather table records

There is one table that likely didn’t have it’s related records removed. Browse through the weather table looking for records with a related setName. The example below looks for records created by the Community reader.

SELECT * FROM weather where setname = 'Community';

You will need to delete these records as well to complete the cleanup.

Step 4 - Optional confirmation step

To confirm that all the related records were deleted check these tables and make sure there are no results for the data_source ID you were removing.

SELECT sourceID, count(*) FROM weather_city group by sourceID;
SELECT sourceID, count(*) FROM wsi_requested group by sourceID;
SELECT sourceID, count(*) FROM wsi_city group by sourceID;
SELECT sourceID, count(*) FROM weather_wsi_codes group by sourceID;

Step 5 - Optional Restart Reader

If you were doing the removal to have a fresh start - you should now be ready to start the reader again.

  • No labels