class BlazingSQLHelper: def __init__(self): cluster = LocalCUDACluster() client = Client(cluster) self._bc = BlazingContext(dask_client=client, network_interface='lo') """This function runs blazingSQL query. :param config: Query related tables configuration. :type config: dict :return: Query results. :rtype: cudf.DataFrame """ def run_query(self, config): for table in config["tables"]: table_name = table["table_name"] file_path = table["input_path"] kwargs = table.copy() del kwargs["table_name"] del kwargs["input_path"] self._bc.create_table(table_name, file_path, **kwargs) sql = config["sql"] log.debug("Executing query: %s" % (sql)) result = self._bc.sql(sql) result = result.compute() return result """This function drops blazingSQL tables. :param table_names: List of table names to drop. :type table_names: List """ def drop_table(self, table_names): for table_name in table_names: log.debug("Drop table: %s" % (table_name)) self._bc.drop_table(table_name)
class BlazingSQLHelper: def __init__(self, pool=False): # Setting pool=True allocates half the GPU memory. self._bc = BlazingContext(pool=pool) """This function runs blazingSQL query. :param config: Query related tables configuration. :type config: dict :return: Query results. :rtype: cudf.DataFrame """ def run_query(self, config): for table in config["tables"]: table_name = table["table_name"] file_path = table["input_path"] kwargs = table.copy() del kwargs["table_name"] del kwargs["input_path"] self._bc.create_table(table_name, file_path, **kwargs) sql = config["sql"] log.debug("Executing query: %s" % (sql)) result = self._bc.sql(sql) self.has_data = False return result """This function drops blazingSQL tables. :param table_names: List of table names to drop. :type table_names: List """ def drop_table(self, table_names): for table_name in table_names: log.debug("Drop table: %s" % (table_name)) self._bc.drop_table(table_name)