Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions skyflow/utils/_skyflow_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Error(Enum):
BULK_DELETE_FAILURE = f"{error_prefix} Delete operation failed."
EMPTY_SKYFLOW_ID= f"{error_prefix} Validation error. skyflow_id can't be empty."
INVALID_FILE_COLUMN_NAME= f"{error_prefix} Validation error. 'column_name' can't be empty."

INAVLID_SKYFLOW_ID = f"{error_prefix} Validation error. Invalid type of skyflow_id. Specify skyflow_id as a string."
INVALID_QUERY_TYPE = f"{error_prefix} Validation error. Query parameter is of type {{}}. Specify as a string."
EMPTY_QUERY = f"{error_prefix} Validation error. Query parameter can't be empty. Specify as a string."
INVALID_QUERY_COMMAND = f"{error_prefix} Validation error. {{}} command was passed instead, but only SELECT commands are supported. Specify the SELECT command."
Expand Down Expand Up @@ -278,7 +278,6 @@ class Info(Enum):
VALIDATING_FILE_UPLOAD_REQUEST = f"{INFO}: [{error_prefix}] Validating file upload request."
FILE_UPLOAD_REQUEST_RESOLVED = f"{INFO}: [{error_prefix}] File upload request resolved."
FILE_UPLOAD_SUCCESS = f"{INFO}: [{error_prefix}] File uploaded successfully."
FILE_UPLOAD_REQUEST_REJECTED = f"{ERROR}: [{error_prefix}] File upload failed."

INVOKE_CONNECTION_TRIGGERED = f"{INFO}: [{error_prefix}] Invoke connection method triggered."
VALIDATING_INVOKE_CONNECTION_REQUEST = f"{INFO}: [{error_prefix}] Validating invoke connection request."
Expand Down Expand Up @@ -308,6 +307,7 @@ class Info(Enum):
DETECT_REQUEST_RESOLVED = f"{INFO}: [{error_prefix}] Detect request is resolved."

class ErrorLogs(Enum):
FILE_UPLOAD_REQUEST_REJECTED = f"{ERROR}: [{error_prefix}] File upload failed."
VAULTID_IS_REQUIRED = f"{ERROR}: [{error_prefix}] Invalid vault config. Vault ID is required."
EMPTY_VAULTID = f"{ERROR}: [{error_prefix}] Invalid vault config. Vault ID can not be empty."
CLUSTER_ID_IS_REQUIRED = f"{ERROR}: [{error_prefix}] Invalid vault config. Cluster ID is required."
Expand Down
10 changes: 4 additions & 6 deletions skyflow/utils/validations/_validations.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,11 @@ def validate_file_upload_request(logger, request):
elif table.strip() == "":
raise SkyflowError(SkyflowMessages.Error.EMPTY_TABLE_VALUE.value, invalid_input_error_code)

# Skyflow ID
# if skyflowid is present check its types string or not
skyflow_id = getattr(request, "skyflow_id", None)
if skyflow_id is None:
raise SkyflowError(SkyflowMessages.Error.IDS_KEY_ERROR.value, invalid_input_error_code)
elif skyflow_id.strip() == "":
raise SkyflowError(SkyflowMessages.Error.EMPTY_SKYFLOW_ID.value.format("FILE_UPLOAD"), invalid_input_error_code)

if skyflow_id is not None and (not isinstance(skyflow_id, str)):
raise SkyflowError(SkyflowMessages.Error.INAVLID_SKYFLOW_ID.value.format(type(skyflow_id)), invalid_input_error_code)

# Column Name
column_name = getattr(request, "column_name", None)
if column_name is None:
Expand Down
4 changes: 2 additions & 2 deletions skyflow/vault/data/_file_upload_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
class FileUploadRequest:
def __init__(self,
table: str,
skyflow_id: str,
column_name: str,
file_path: str= None,
base64: str= None,
file_object: BinaryIO= None,
file_name: str= None):
file_name: str= None,
skyflow_id: str= None):
self.table = table
self.skyflow_id = skyflow_id
self.column_name = column_name
Expand Down
2 changes: 0 additions & 2 deletions tests/vault/controller/test__vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,6 @@ def test_validate_empty_skyflow_id(self):
)
with self.assertRaises(SkyflowError) as error:
validate_file_upload_request(self.logger, request)
self.assertEqual(error.exception.message,
SkyflowMessages.Error.EMPTY_SKYFLOW_ID.value.format("FILE_UPLOAD"))

def test_validate_invalid_column_name(self):
"""Test validation fails when column_name is missing"""
Expand Down
Loading