Skip to content

Commit

Permalink
fix table upload implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Jan 17, 2021
1 parent 81760f9 commit b7073f0
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions py/sqlutilpy/sqlutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,25 @@ def upload(tableName,
host=host,
timeout=timeout)
if names is None:
# we assume that we were given a table
if atpy is not None:
if isinstance(arrays, atpy.Table):
names = arrays.columns
arrays = [arrays[_] for _ in names]
elif pandas is not None:
if isinstance(arrays, pandas.DataFrame):
names = arrays.columns
for i in range(1):
# we assume that we were given a table
if atpy is not None:
if isinstance(arrays, atpy.Table):
names = arrays.columns
arrays = [arrays[_] for _ in names]
break
if pandas is not None:
if isinstance(arrays, pandas.DataFrame):
names = arrays.columns
arrays = [arrays[_] for _ in names]
break
if isinstance(arrays, dict):
names = arrays.keys()
arrays = [arrays[_] for _ in names]
break
if names is None:
raise Exception('you either need to give astropy \
table/pandas/dictionary or provide a separate list of arrays and their names')

arrays = [np.asarray(_) for _ in arrays]
repl_char = {' ': '_', '-': '_', '(': '_', ')': '_', '[': '_', ']': '_'}
Expand Down

0 comments on commit b7073f0

Please sign in to comment.