Skip to content

Commit

Permalink
Added new args to load_data and added new test about load_data
Browse files Browse the repository at this point in the history
  • Loading branch information
xmnlab committed May 24, 2018
1 parent b73c78a commit 71d64e4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ibis/mapd/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def database(self, name=None):
)
return self.database_class(name, new_client)

def load_data(self, table_name, obj, database=None):
def load_data(self, table_name, obj, database=None, *args, **kwargs):
"""
Wraps the LOAD DATA DDL statement. Loads data into an MapD table by
physically moving data files.
Expand All @@ -704,7 +704,7 @@ def load_data(self, table_name, obj, database=None):
"""
_database = self.db_name
self.set_database(database)
self.con.load_table(table_name, obj)
self.con.load_table(table_name, obj, *args, **kwargs)
self.set_database(_database)

@property
Expand Down
19 changes: 19 additions & 0 deletions ibis/mapd/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,22 @@ def test_compile_toplevel():
result = ibis.mapd.compile(expr)
expected = 'SELECT sum("foo") AS "sum"\nFROM t0' # noqa
assert str(result) == expected


def test_load_data(con):
import ibis.pandas

df = pd.DataFrame({
'a': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
'b': [28., 55., 43, 91, 81, 53, 19, 87, 52]
})

tb = ibis.pandas.connect({'value': df}).table('value')

try:
con.drop_table('value')
except Exception:
pass
con.create_table('value', schema=tb.schema())
con.load_data('value', df)
con.drop_table('value')

0 comments on commit 71d64e4

Please sign in to comment.