From 1b13dd1721976518b1a5e922f137838c36dede4a Mon Sep 17 00:00:00 2001 From: mohammadrezapourreza Date: Wed, 3 Apr 2024 12:10:34 -0400 Subject: [PATCH] DH5669/rename the function to make more sense --- dataherald/scripts/populate_dialect_db_connection.py | 2 +- dataherald/sql_database/models/types.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dataherald/scripts/populate_dialect_db_connection.py b/dataherald/scripts/populate_dialect_db_connection.py index 290461cf..64fea056 100644 --- a/dataherald/scripts/populate_dialect_db_connection.py +++ b/dataherald/scripts/populate_dialect_db_connection.py @@ -16,7 +16,7 @@ decrypted_uri = fernet_encrypt.decrypt( database_connection["connection_uri"] ) - dialect_prefix = DatabaseConnection.validate_uri(decrypted_uri) + dialect_prefix = DatabaseConnection.get_dialect(decrypted_uri) dialect = DatabaseConnection.set_dialect(dialect_prefix) storage.update_or_create( "database_connections", diff --git a/dataherald/sql_database/models/types.py b/dataherald/sql_database/models/types.py index 27e4756c..941a4390 100644 --- a/dataherald/sql_database/models/types.py +++ b/dataherald/sql_database/models/types.py @@ -103,7 +103,7 @@ class DatabaseConnection(BaseModel): created_at: datetime = Field(default_factory=datetime.now) @classmethod - def validate_uri(cls, input_string): + def get_dialect(cls, input_string): pattern = r"([^:/]+):/+([^/]+)/([^/]+)" match = re.match(pattern, input_string) if not match: @@ -123,7 +123,7 @@ def connection_uri_format(cls, value: str, values): try: fernet_encrypt.decrypt(value) except Exception: - dialect_prefix = cls.validate_uri(value) + dialect_prefix = cls.get_dialect(value) values["dialect"] = cls.set_dialect(dialect_prefix) value = fernet_encrypt.encrypt(value) return value