Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 523 #524

Merged
merged 3 commits into from
Aug 4, 2023
Merged
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
3 changes: 2 additions & 1 deletion vertica_python/vertica/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ def _handle_copy_local_protocol(self):
# Check that the input files are readable
self.valid_read_file_path = self._check_copy_local_files(input_files)

self.connection.write(messages.VerifiedFiles(self.valid_read_file_path))
self.connection.write(messages.VerifiedFiles(self.valid_read_file_path,
self.connection.parameters.get('protocol_version', 0)))
except Exception as e:
tb = sys.exc_info()[2]
stk = traceback.extract_tb(tb, 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@
class VerifiedFiles(BulkFrontendMessage):
message_id = b'F'

def __init__(self, file_list):
def __init__(self, file_list, protocol_version):
BulkFrontendMessage.__init__(self)
self.filenames = file_list
self.protocol_version = protocol_version

def read_bytes(self):
bytes_ = pack('!I', len(self.filenames))
if self.protocol_version >= (3 << 16 | 15):
bytes_ = pack('!I', len(self.filenames)) # Int32
else:
bytes_ = pack('!H', len(self.filenames)) # Int16
for filename in self.filenames:
utf_filename = filename.encode('utf-8')
bytes_ += pack('!{0}sx'.format(len(utf_filename)), utf_filename)
Expand Down