From 3afe292b23924c40564290cf82acb2723c861060 Mon Sep 17 00:00:00 2001 From: Nick Heppler Date: Thu, 22 May 2025 12:12:01 -0400 Subject: [PATCH] fix: Ensure feature layer is truncated at the start of script execution - Moved the call to the truncate function to always execute at the beginning of the main function. - Ensured that the feature layer is cleared before loading data from a JSON file or fetching from the API. --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index cff11b2..366e5ef 100644 --- a/app.py +++ b/app.py @@ -336,10 +336,12 @@ def main(): fs = os.getenv('FS') layer = os.getenv('LAYER') + logger.info("Truncating the feature layer.") + truncate(token, hostname, instance, fs, layer) + # If --reload flag is set, load data from the specified file if reload_file: logger.info(f"Reloading data from file: {reload_file}") - truncate(token, hostname, instance, fs, layer) # Truncate the layer # Load data from the specified file with open(reload_file, 'r', encoding='utf-8') as f: