Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self):
self.read_pipe.close()
http_export = pyexasol.http_transport(self.node['host'], self.node['port'], pyexasol.HTTP_EXPORT, compression=True, encryption=True)
http_import = pyexasol.http_transport(self.node['host'], self.node['port'], pyexasol.HTTP_IMPORT, compression=True, encryption=True)
# Send list of proxy strings, one element per HTTP transport instance
self.write_pipe.send([http_export.get_proxy(), http_import.get_proxy()])
self.write_pipe.close()
pd = http_export.export_to_callback(cb.export_to_pandas, None)
print(f"EXPORT shard_id:{self.node['idx']}, affected_rows:{len(pd)}")
http_import.import_from_callback(cb.import_from_pandas, pd)
print(f"IMPORT shard_id:{self.node['idx']}, affected_rows:{len(pd)}")
def run(self):
self.read_pipe.close()
http = pyexasol.http_transport(self.node['host'], self.node['port'], pyexasol.HTTP_IMPORT)
self.write_pipe.send(http.get_proxy())
self.write_pipe.close()
data = [
{'user_id': 1, 'user_name': 'John', 'shard_id': self.node['idx']},
{'user_id': 2, 'user_name': 'Foo', 'shard_id': self.node['idx']},
{'user_id': 3, 'user_name': 'Bar', 'shard_id': self.node['idx']},
]
pd = pandas.DataFrame(data, columns=['user_id', 'user_name', 'shard_id'])
http.import_from_callback(cb.import_from_pandas, pd)
def import_from_pandas(self, src, table, callback_params=None, import_params=None):
return self.import_from_callback(cb.import_from_pandas, src, table, callback_params, import_params)