Add check for existing array URI before any CSV/dataframe ops
@@ -415,7 +415,6 @@ def from_pandas(uri, dataframe, **kwargs):
"""
check_dataframe_deps()
-
import pandas as pd
if 'tiledb_args' in kwargs:
@@ -441,6 +440,9 @@ def from_pandas(uri, dataframe, **kwargs):
date_spec = tiledb_args.get('date_spec', None)
column_types = tiledb_args.get('column_types', None)
+ if mode != 'append' and tiledb.array_exists(uri):
+ raise TileDBError("Array URI '{}' already exists!".format(uri))
+
write = True
create_array = True
if mode is not None:
@@ -741,6 +743,9 @@ def from_csv(uri, csv_file, **kwargs):
elif mode not in ['ingest', 'append']:
raise TileDBError("Invalid mode specified ('{}')".format(mode))
+ if mode != 'append' and tiledb.array_exists(uri):
+ raise TileDBError("Array URI '{}' already exists!".format(uri))
+
# this is a pandas pass-through argument, do not pop!
chunksize = kwargs.get('chunksize', None)
