Skip to content

Commit

Permalink
DH5669/rename the function to make more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza committed Apr 3, 2024
1 parent 06cdeb1 commit 1b13dd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dataherald/scripts/populate_dialect_db_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions dataherald/sql_database/models/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 1b13dd1

Please sign in to comment.