From 28f46aa5e751e71bab8b81532c8e73b2663d34fe Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Mon, 27 May 2024 13:12:51 -0300 Subject: [PATCH] fix: after slicing name trim to remove whitespace If the sliced name ends in white space replacing whitespace with underscores will add an extra underscore at the end of the file which can cause issues when prasing for the query id --- scripts/pull_from_dune.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pull_from_dune.py b/scripts/pull_from_dune.py index 9b60313..15e8670 100644 --- a/scripts/pull_from_dune.py +++ b/scripts/pull_from_dune.py @@ -43,7 +43,7 @@ file.write(f'-- part of a query repo\n-- query name: {query.base.name}\n-- query link: https://dune.com/queries/{query.base.query_id}\n\n\n{query.sql}') else: # Create new file and directories if they don't exist - new_file = f'{query.base.name.replace(" ", "_").lower()[:30]}___{query.base.query_id}.sql' + new_file = f'{query.base.name.lower()[:30].strip().replace(" ", "_")}___{query.base.query_id}.sql' file_path = os.path.join(os.path.dirname(__file__), '..', 'queries', new_file) os.makedirs(os.path.dirname(file_path), exist_ok=True)