Skip to content

Commit

Permalink
DH5669/removing the validation on object for dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadrezaPourreza committed Apr 2, 2024
1 parent 19868a3 commit 941493a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions dataherald/sql_database/models/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,11 @@ def set_dialect(cls, input_string):
def connection_uri_format(cls, value: str, values):
fernet_encrypt = FernetEncrypt()
try:
decrypted_connection_uri = fernet_encrypt.decrypt(value)
dialect_prefix = cls.validate_uri(decrypted_connection_uri)
fernet_encrypt.decrypt(value)
except Exception:
dialect_prefix = cls.validate_uri(value)
values["dialect"] = cls.set_dialect(dialect_prefix)
value = fernet_encrypt.encrypt(value)
values["dialect"] = cls.set_dialect(dialect_prefix)
return value

@validator("llm_api_key", pre=True, always=True)
Expand Down
1 change: 0 additions & 1 deletion dataherald/tests/db/test_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def __init__(self, system: System):
{
"_id": ObjectId("64dfa0e103f5134086f7090c"),
"alias": "alias",
"dialect": "dialect",
"use_ssh": False,
"connection_uri": "gAAAAABkwD9Y9EpBxF1hRxhovjvedX1TeDNu-WaGqDebk_CJnpGjRlpXzDOl_puehMSbz9KDQ6OqPepl8XQpD0EchiV7he4j5tEXYE33eak87iORA7s8ko0=", # noqa: E501
"ssh_settings": None,
Expand Down
1 change: 0 additions & 1 deletion dataherald/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def test_scan_all_tables():
"/api/v1/table-descriptions/sync-schemas",
json={"db_connection_id": "64dfa0e103f5134086f7090c"},
)
print(response.json())
assert response.status_code == HTTP_201_CODE


Expand Down

0 comments on commit 941493a

Please sign in to comment.