From fc04f056372dbd933ccb9f60baac86459d33d40f Mon Sep 17 00:00:00 2001 From: SakshiKekre Date: Tue, 31 Dec 2024 21:16:56 -0800 Subject: [PATCH] Removed seed method definition and method calls from PolicyEngineDatabase class --- changelog_entry.yaml | 4 ++++ policyengine_api/data/data.py | 27 --------------------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29b..eb8668f0 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + removed: + - seed method from PolicyEngineDatabase class \ No newline at end of file diff --git a/policyengine_api/data/data.py b/policyengine_api/data/data.py index 0230d158..5b2d8470 100644 --- a/policyengine_api/data/data.py +++ b/policyengine_api/data/data.py @@ -37,8 +37,6 @@ def __init__( if initialize: self.initialize() - self.seed() - def _create_pool(self): instance_connection_name = ( "policyengine-api:us-central1:policyengine-api-data" @@ -101,31 +99,6 @@ def dict_factory(cursor, row): except Exception as e: raise e - def seed(self): - """ - Pre-seed the database with records in the relevant folder - """ - - folder = REPO / "policyengine_api" / "data" / "seed" - - # Recursively loop through all SQL scripts in folder - for dirpath, dirnames, filenames in os.walk(folder): - for filename in filenames: - full_filepath = os.path.join(dirpath, filename) - with open(full_filepath, "r") as file: - try: - full_query = file.read() - queries = full_query.split(";") - for query in queries: - self.query(query) - - except Exception as e: - continue - print( - f"Error while seeding database with record {filename}: {e}", - file=sys.stdout, - ) - def initialize(self): """ Create the database tables.