Skip to content

Commit

Permalink
return cursor so we can get stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Mizikar committed Sep 19, 2017
1 parent b7911b0 commit faec089
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ibis/impala/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ def text_file(self, hdfs_path, column_name='value'):
pass

def insert(self, table_name, obj=None, database=None, overwrite=False,
partition=None, values=None, validate=True):
partition=None, values=None, validate=True, results=False):
"""
Insert into existing table.
Expand All @@ -1085,6 +1085,7 @@ def insert(self, table_name, obj=None, database=None, overwrite=False,
----------
table_name : string
database : string, default None
results : boolean, default False
Examples
--------
Expand All @@ -1095,7 +1096,7 @@ def insert(self, table_name, obj=None, database=None, overwrite=False,
"""
table = self.table(table_name, database=database)
return table.insert(obj=obj, overwrite=overwrite, partition=partition,
values=values, validate=validate)
values=values, validate=validate, results=results)

def load_data(self, table_name, path, database=None, overwrite=False,
partition=None):
Expand Down Expand Up @@ -1649,7 +1650,7 @@ def drop(self):
self._client.drop_table_or_view(self._qualified_name)

def insert(self, obj=None, overwrite=False, partition=None,
values=None, validate=True):
values=None, validate=True, results=False):
"""
Insert into Impala table. Wraps ImpalaClient.insert
Expand All @@ -1667,6 +1668,9 @@ def insert(self, obj=None, overwrite=False, partition=None,
validate : boolean, default True
If True, do more rigorous validation that schema of table being
inserted is compatible with the existing table
results : boolean, default True
If True, return a ibis cursor. This is useful for getting stats on
inserts.
Examples
--------
Expand Down Expand Up @@ -1713,7 +1717,7 @@ def insert(self, obj=None, overwrite=False, partition=None,
partition=partition,
partition_schema=partition_schema,
overwrite=overwrite)
return self._execute(statement)
return self._execute(statement, results=results)

def load_data(self, path, overwrite=False, partition=None):
"""
Expand Down Expand Up @@ -1772,8 +1776,8 @@ def rename(self, new_name, database=None):
op = self.op().change_name(statement.new_qualified_name)
return ImpalaTable(op)

def _execute(self, stmt):
return self._client._execute(stmt)
def _execute(self, stmt, results=False):
return self._client._execute(stmt, results=results)

@property
def is_partitioned(self):
Expand Down

0 comments on commit faec089

Please sign in to comment.