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.
This commit is contained in:
parent
cad8d64c23
commit
3afe292b23
4
app.py
4
app.py
@ -336,10 +336,12 @@ def main():
|
|||||||
fs = os.getenv('FS')
|
fs = os.getenv('FS')
|
||||||
layer = os.getenv('LAYER')
|
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 flag is set, load data from the specified file
|
||||||
if reload_file:
|
if reload_file:
|
||||||
logger.info(f"Reloading data from file: {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
|
# Load data from the specified file
|
||||||
with open(reload_file, 'r', encoding='utf-8') as f:
|
with open(reload_file, 'r', encoding='utf-8') as f:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user