Skip to content

Commit

Permalink
Merge pull request #22 from maxmzkr/DP-322
Browse files Browse the repository at this point in the history
return cursor so we can get stats
  • Loading branch information
maxmzkr authored Sep 21, 2017
2 parents 2d3652d + faec089 commit fd192bf
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 @@ -1082,7 +1082,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 @@ -1092,6 +1092,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 @@ -1102,7 +1103,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 @@ -1656,7 +1657,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 @@ -1674,6 +1675,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 @@ -1720,7 +1724,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 @@ -1779,8 +1783,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 fd192bf

Please sign in to comment.